This question already has an answer here:
- What Delimiter to use for preg_replace in PHP (replace working outside of PHP but not inside) 3 answers
Warning: preg_replace(): No ending delimiter '/' found in C:\wamp\www\upload\upload_demo.php on line 77 I used preg_replace() to replace slash to backslash. But it shows the above warning. Here is the code..
function del_file($file) {
$delete = @unlink($file);
clearstatcache();
if (@file_exists($file)) {
$filesys = preg_replace("/", "\\\\", $file);
$delete = @system("del $filesys");
clearstatcache();
if (@file_exists($file)) {
$delete = @chmod($file, 0775);
$delete = @unlink($file);
$delete = @system("del $filesys");
}
}