Execution of my PHP script halts if I have this piece of code in it with no error
return str_replace(
str_repeat($currentOsSeparator, 2),
'//',
str_replace(
$separators,
$currentOsSeparator,
$path),
1);
Now, the tricky part is that execution stops even if this code is after a return statement.
Is that supposed to be a function? Not sure what you're trying to do. The error returned for the above code on its own is
PHP Fatal error: Only variables can be passed by reference
You should read this: http://php.net/manual/en/function.return.php
If called from the global scope, then execution of the current script file is ended
But without seeing more of your code or more explanation it's hard to help.