- stripslashes: documentation ( source)
- preg_replace_callback: documentation ( source)
- str_replace: documentation ( source)
<?php
$test='lalala "foo bar" lalala';
$test = preg_replace_callback(
'#"([^"]+)"#si',
function ($match) {
return stripslashes(str_replace(' ', '*', $match[0]));
},
$test
);
echo $test;