[OpenTRV-dev] OT: replacement of danish char's inside a word

Bo Herrmannsen EMAIL ADDRESS HIDDEN
Tue Mar 18 13:14:38 GMT 2014


Hi

anyone that can help me out with php?


i need to replace some special danish char's with something else. This should happen no matter where they pop up.


$string = $row['delivery_street_address']; 

$patterns = array();
$patterns[0] = '*å*';
$patterns[1] = '*æ*';
$patterns[2] = '*ø*';
  
  
$replacements = array();
$replacements[3] = '/x7D';
$replacements[2] = 'X';
$replacements[1] = '/x7C';

echo preg_replace($patterns, $replacements, $string);



the address in this case is: Sandkæret 1,1,1

but these 3 letters can pop up anywhere in any numbers

all help is welcome :-D




More information about the OpenTRV-dev mailing list