Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
Created August 28, 2015 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phpfiddle/2de39ac6d4767b349480 to your computer and use it in GitHub Desktop.
Save phpfiddle/2de39ac6d4767b349480 to your computer and use it in GitHub Desktop.
[ Posted by LiviuS ] function + for + if/eleif + call function
<?php
function goOn($number){
for($i=0; $i < $number; $i++){
$name = "Apprentice";
$random = rand(0,3);
if($random==0)
{
$name = "Intermediate Apprentice <br/>";
}
elseif($random==1)
{
$name = "Advanced Apprentice <br/>";
}
elseif($random==2)
{
$name = "Higher Apprentice <br/>";
}
elseif($random==3)
{
$name = "Proffesional <br/>";
}
echo ("You are a " .$name);
}
}
goOn(5);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment