if (0) { // false same as empty, true same as 1
echo "true";
} else {
echo "false";
}
// therefore condition returns false :)
<?php
$today =(date'z');
if ($today==1) {
echo "დღეს არის წლის $today-ლი დღე";
}
elseif ($today>=2 and $today<=20) {
echo "დღეს არის წლის მე-$today დღე";
}else
echo "დღეს არის წლის $today-ე დღე";
?>
<?php
for ($i=1;$i<=50;$i++) {
echo "$i ";
if ($i%5==0) {
echo "\n";
}
}
?>
$str = "Hello world";
print_r (explode(" ",$str));
Return:
Array ( [0] => Hello [1] => world )
The code will return a string containing the elements of the array.
$arr = array('Hello','World!');
echo implode(" ",$arr);
Return:
Hello World!
<?php
$my_name = "oto";
$my_weight = 70; //kg
$my_height = 177; //m
$his_name = "guduna";
$his_weight = 77;
$his_height = 200;
if ($my_weight < $his_weight) {
echo "hi is fatter! ";
}
if ($my_height < $his_height) {
echo "hi is taller!";
}
$result = "First" && false;
var_dump($result);
result will be 'First', because first executes $result = "First" and next execute AND operator.
Like this: ($result = "First") && false;
$result = "First" AND false;
var_dump($result);