Aims:
NULL
NULL is silently
converted to the empty string ('') (or 0, 0.0 or
false as appropriate)
NULL is converted to
the empty string (or 0, 0.0 or false as appropriate)
<body>
<?php
$surname = $_GET['surname'];
echo '<p>';
echo 'Hello ';
echo $firstname;
echo ' ';
echo $surname;
echo '</p>';
?>
</body>
<body>
<?php
$firstname = $_GET['firstname'];
$surname = $_GET['surname'];
echo '<p>';
echo 'Hello ';
echo $frstname;
echo ' ';
echo $surname;
echo '</p>';
?>
</body>
<body>
<?php
$firstname = $_GET['firstname'];
$surname = $_GET['surname'];
echo '<p>';
echo 'Hello ';
echo $firstName;
echo ' ';
echo $surname;
echo '</p>';
?>
</body>
<body>
<?php
$firstname = $_GET['firstname'];
$surname = $_GET['surname'];
echo '<p>';
echo 'Hello ';
echo firstname;
echo ' ';
echo $surname;
echo '</p>';
?>
</body>
2 + 3
2 + (3 * 4)
'Hello ' . 'world!'
evaluates to
'Hello world!'
$word1 = 'Happy'; $word2 = 'Christmas'; $laugh = 'Ho';
echo $word1 . $word2;echo $word1 . ' ' . $word2;echo $laugh . $laugh . $laugh;$wishes = $word1 . ' ' . $word2; $laugh = $laugh . ' ' . $laugh . ' ' . $laugh;
echo $wishes;echo $laugh;echo 'Ho ' . $laugh . ' Ho';What do the variables contain at the end of all this?
<body>
<?php
$firstname = $_GET['firstname'];
$surname = $_GET['surname'];
echo '<p>Hello ' . $firstname . ' ' . $surname . '</p>';
?>
</body>
echo "\"Marry me,\" he said.\n\"No way,\" she replied."; echo "\"In that case, 1\\2 a pound of cheese, please," he said.";
echo '<p>'; echo 'Hello '; echo $firstname; echo ' '; echo $surname; echo '</p>';
echo '<p>Hello ' . $firstname . ' ' . $surname . '</p>';
echo "<p>Hello {$firstname} {$surname}</p>";
$answer = 'forty-two';
echo 'The answer is ' . $answer;echo 'The answer is {$answer}';echo 'The answer is $answer';echo "The answer is " . $answer;echo "The answer is {$answer}";echo "The answer is $answer";