php - str_replace() removes numeric value with / in a string? -
my code:
<?php $string="img\1\evs\good habits.mp41.png"; echo str_replace('\\','/',$string); ?> output:
img/evs/good habits.mp41.png my original string : img\1\evs\good habits.mp41.png, in output removed 1.
please tell me reason if know ?
it's not fault str_replace(). if do:
echo $string; you see lost number there:
img\evs\good habits.mp41.png because backslash escapes 1. solution?
you have escape backslashes in original string or change double quotes single quotes, escape sequence doesn't interpreted php anymore.
Comments
Post a Comment