Jump to content

how would i escape this?


joemorris86

Recommended Posts

Just put backslashes before the double quotes. If your string starts and ends with double quotes, then you need to escape double quotes inside the string. You can also enclose the string with single quotes, and then you don't need to escape anything but you'll need to concatenate the variable if you use single quotes.

Link to comment
Share on other sites

Would anyone be able to show me how to escape the 2 forward slashes before and after $div? i tried backslashes but i got the following errorecho "[ - <a href='". /$dir/ ."game_play.php'>Play</a> - ]";Parse error: syntax error, unexpected '.' in /var/www/html/game/game_status.php on line 12

Link to comment
Share on other sites

Place them into the string, not outside of it:

echo "[ - <a href='/". $dir ."/game_play.php'>Play</a> - ]";

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...