Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
33
Task/Undefined-values/PHP/undefined-values.php
Normal file
33
Task/Undefined-values/PHP/undefined-values.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
// Check to see whether it is defined
|
||||
if (!isset($var))
|
||||
echo "var is undefined at first check\n";
|
||||
|
||||
// Give it a value
|
||||
$var = "Chocolate";
|
||||
|
||||
// Check to see whether it is defined after we gave it the
|
||||
// value "Chocolate"
|
||||
if (!isset($var))
|
||||
echo "var is undefined at second check\n";
|
||||
|
||||
// Give the variable an undefined value.
|
||||
unset($var);
|
||||
|
||||
// Check to see whether it is defined after we've explicitly
|
||||
// given it an undefined value.
|
||||
if (!isset($var))
|
||||
echo "var is undefined at third check\n";
|
||||
|
||||
// Give the variable a value of 42
|
||||
$var = 42;
|
||||
|
||||
// Check to see whether the it is defined after we've given it
|
||||
// the value 42.
|
||||
if (!isset($var))
|
||||
echo "var is undefined at fourth check\n";
|
||||
|
||||
// Because most of the output is conditional, this serves as
|
||||
// a clear indicator that the program has run to completion.
|
||||
echo "Done\n";
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue