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
Sometimes, in linux/unix environment,
$strippedId = preg_replace('/\h/u', '', $id);
Try this as well.