Paul Adebayo
0
Q:

if statement php

$a = random_int(0, 10);
$b = random_int(0, 10);
if ($a > $b) {
  echo 'a is greater than b';
} elseif ($a == $b) {
  echo 'a is equal to b';
} else {
  echo 'a is less than b';
}
8

<?php
if ($a > $b) {
    echo "a is bigger than b";
} elseif ($a == $b) {
    echo "a is equal to b";
} else {
    echo "a is smaller than b";
}
?>

5

<?php
if ($a > $b) {
  echo "a is bigger than b";
  $b = $a;
}
?>

5
<?php
if ($a > $b)
  echo "a is bigger than b";
?>
3
if ($t < "20") {
    echo "Have a good day!";
} 
else if($t < "40" {
    echo "Have a good afternoon!";
}
else{
 	echo "Have a good evening!"; 
}
3
if (condition) {
  expression
}
0

New to Communities?

Join the community