
|
 |

Using double quotes with variablesWhen you're outputing variables amongst HTML, if there's a chance there might be an apostrophe ' in your variable, use double quotes in your HTML. For example,
<?php
echo "<img src=\"$filename\">";
?>
|
Note the escape character \ allowing me to use the double quote. This is particularly important when pulling data from a form or database where you're not certain what might be there. Comments
Comment by John on 2004-12-03
Another option is:
";
?>
|
|
|