Login form



PHP. IF, SWITCH Conditions and comparison, PART 2
Values of conditions::

<?
if (5<4) echo ("1 Tai nebus išvesta<br>");           // false
if (false) echo ("2 Tai nebus išvesta<br>");          //false yra PHP konstanta
if ("0") echo ("3 Tai nebus išvesta<br>");            //Apdorojant eilutes, "0" virsta 0
if ($g) echo("4 Tai nebus išvesta<br>");             //Tuo atveju jei $g nėra priskirta
if ("false") echo ("5 Tai bus išvesta<br>");         // false jau yra nebe konstanta, o eilutė
if ("00") echo ("6 Tai bus išvesta<br>");           // eilutė iš dviejų nulių nėra perdirbama į sveikojo tipo reikšmę
if (0 =="") echo ("7 Tai bus išvesta<br>");       // nulis lygus nuliui, todėl sąlyga patenkinta
if (0 ==="") echo ("8 Tai nebus išvesta<br>"); // nulis lygus nuliui, todėl sąlyga patenkinta
if (((4<5) && (3>2)) xor (5 == 5)) echo ("9 Tai išvesta nebus<br>"); // teisingos abi sąlygos, apjungtos operatoriusmi xor, todėl viso išsireiškimas
?>

isset determines whether a variable is set.
If a variable has been unset with unset(), it will no longer be set. isset() will return FALSE if testing a variable that has been set to NULL. Also note that a NULL byte ("\0") is not equivalent to the PHP NULL constant..

<?
$var = '';

// This will evaluate to TRUE so the text will be printed.
if (isset($var)) {
echo "This var is set so I will print.";
}
?>

var_dump function displays structured information about one or more expressions that includes its type and value.

<?

$a = "test";
$b = "anothertest";

var_dump ($a);              // TRUE
var_dump(isset($a));      // TRUE
var_dump ($b);              // TRUE
var_dump(isset($a, $b)); // TRUE

unset ($a);

var_dump(isset($a));       // FALSE
var_dump(isset($a, $b)); // FALSE

$foo = NULL;
var_dump(isset($foo));   // FALSE

?>
 
[ BBC news ][ Yahoo news ][ Linux guru ][ Webmaster ACE ]