-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
  • 152
  • 4
  • 13

1 Answers1

2

You need to escape the backslash:

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

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

GoWiser
  • 857
  • 6
  • 20