Jump to content

how would i escape this?


joemorris86
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...