Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
Created August 27, 2015 12:25
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/6f9722136f2463a2c777 to your computer and use it in GitHub Desktop.
Save phpfiddle/6f9722136f2463a2c777 to your computer and use it in GitHub Desktop.
[ Posted by LiviuS ] if , elseif , random
<?php
$class = "Level 1";
$random = rand(0,3);
if($random==0)
{
$class = "Level 2";
}
elseif($random==1)
{
$class = "Level 3";
}
elseif($random==2)
{
$class = "Level 4";
}
$name = "Apprentice";
$random = rand(0,3);
if($random==0)
{
$name = "Intermediate Apprentice";
}
elseif($random==1)
{
$name = "Advanced Apprentice";
}
elseif($random==2)
{
$name = "Higher Apprentice";
}
elseif($random==3)
{
$name = "Proffesional";
}
echo ("You are a " .$name. " " .$class. ".");
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment