i need to transform nubmer to string (dividing each 3 numbers by space, i.e 20000 => 20 000, 1400000 => 1 400 000)
my code:
$cena = '20000';
$cena = preg_replace('/\D+/g', '', $cena);
$cena = preg_replace('/\d(?=(?:\d{3})+(?!\d))/g', '$& ', $cena);
this results in:
Warning: preg_replace() [function.preg-replace]: Unknown modifier 'g' in myfile.php on line xxx
what’s wrong?
1 Answer