|
home—lects—hws
D2L—breeze (snow day)
echo "This is a php string.\n"; echo 'So is this, though we'll tend to prefer double-quotes (read more below).\n'; echo "\n"; echo "Remember that spaces are just regular ol' characters (not 'nothing'), "; echo "and that the empty-string is a string (not 'nothing').\n"; echo "The length of five spaces: strlen(\" \") = ", strlen(" "); echo "The length of the empty string: strlen(\"\") = ", strlen(""); echo "The length of a string consisting of just the newline character: strlen(\"\\n\") = ", strlen("\n"); |
<?php echo "hello there everybody!"; echo ' -- Dr. Nick '; ?> |
$str = "How are you?"; $first_name = "John"; $str = "How are you " . $first_name . "?"; $str = "How are you $first_name?"; // alternately $date = "1/01/2010"; // This is a string of course, not a "date type", nor division. $str2 = "I said, \"how are you?\""; // To use a variable followed by literal-chars that aren't part of the variable name: $str3 = "Curly braces are as cute as you are, ${first_name}y-poo!"; |
home—lects—hws
D2L—breeze (snow day)
©2017, Ian Barland, Radford University Last modified 2017.Sep.04 (Mon) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |