-1

I have problem when replace char \ to / here my code:

$loc = str_replace('\','/',$loc);

but that code error:

Parse error: syntax error, unexpected '>' in /

her03
  • 142
  • 4
  • 12

1 Answers1

1

You need to escape the backslash:

$loc = str_replace('\\','/',$loc);

See also:
Do I need to escape backslashes in PHP?

GoWiser
  • 702
  • 3
  • 17