I have a problem with the function str_replace(). I have this code:
$headImageName = "C:\Program Files\EasyPHP-5.3.3.1\www\realitka/headImages/hImageMini4e7b5a6ea8c95Pyro.png";
die(var_dump(str_replace("C:\Program Files\EasyPHP-5.3.3.1\www\realitka/", "", $headImageName)));
And the result of var_dump is again:
string(88) "C:\Program Files\EasyPHP-5.3.3.1\www\realitka/headImages/hImageMini4e7b5bae39148Pyro.png"
Do you have any idea where is the problem?
The
\rin a double quoted string has special meaning.PHP interpret it as carriage return character.
Either use single quotes:
Or escape all your slashes:
See the list of escape sequences in double-quoted strings.