joemorris86 Posted August 22, 2011 Share Posted August 22, 2011 hey guys, would someone be able to show me how i would escape this so the echo works. Thanks echo "[ - <a href="/$dir/game_play.php">Play</a> - ]"; Link to comment Share on other sites More sharing options...
justsomeguy Posted August 22, 2011 Share Posted August 22, 2011 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 More sharing options...
joemorris86 Posted August 22, 2011 Author Share Posted August 22, 2011 thanks Link to comment Share on other sites More sharing options...
joemorris86 Posted August 24, 2011 Author Share Posted August 24, 2011 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 More sharing options...
boen_robot Posted August 24, 2011 Share Posted August 24, 2011 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 More sharing options...
joemorris86 Posted August 24, 2011 Author Share Posted August 24, 2011 cheers buddy 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.