Login form



PHP. IF, SWITCH Conditions and comparison, PART 1
Condition depends on value of $a , result is some HTML code.

<?
$a=2;
if ($a == 2){
?>
<p>labas rytas<font color=#008000> ponai</font>
<?
}else{
?>
<img src="/./Sun.gif">
<?
}
?>

Destroying variable: in case not strict == condition null false "" 0 is the same.

<?
unset ($a);

echo "kintamasis a : " . $a ;
if ($a == 0){
?>
yra toks kintamasis: $a = 0
<?
}else{
?>
nera kintamojo $a = 0
<?
}

?>

In case strict === condition null false "" 0 is NOT the same.

<?
echo "kintamasis a : " . $a ;
if ($a === 0){
?>
yra toks kintamasis $a = 0
<?
}else{
?>
nera kintamojo $a =0
<?
}
?>

Possible conditions:

(condition) && (condition)
(condition) || (condition)

>=
<=
!=
<>
!$a
$a
===
>
<==

&& - AND
|| - OR
!&& - NOT AND
!|| - NOT OR


XOR


A B A xor B
T T F
T F T
F T T
F F F

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