hi. i want to use str_replace in my page with the following code echo = str_replace("Z:\", "/images/", $row['sofname']); PHP: witch Z:\ is the local path of image folder (network drive) and i want to replace it with "/images/". But in PHP the \ it's used for another purpose and it's not working. How i can use this character inside the str_replace? thanks in advance.
You need to escape the backslash by adding another backslash in front of it. <?php $string = "Z:\\path\sub"; $replaced = str_replace('Z:\\', '/images/', $string); var_dump($replaced); ?> PHP: Tested code, works.