I\'m trying to replace all spaces with underscores and the following is not working:
$id = \"aa aa\"; echo $id; preg_replace(\'/\\s+/\', \'_\', $id); echo $i
You have forgotten to assign the result of preg_replace into your $id
preg_replace
$id
$id = preg_replace('/\s+/', '_', $id);