•  
     

rand if elseif else - PHP

PHP

Código: Selecionar todos

$RandomNumber = rand(1, 4);
if ($RandomNumber == '1') { // PHP If Statement
  echo 'The number was 1';
} elseif ($RandomNumber == '2') { // PHP Elseif Statement
  echo 'The number was 2';
} elseif ($RandomNumber == '3') { // PHP Elseif Statement
  echo 'The number was 3';
} else {
  echo 'The number was 4'; // PHP Else
}


HTML
The number was 1, 2, 3 or 4