Last active
August 27, 2015 12:23
-
-
Save phpfiddle/b3c1ac53953346c98114 to your computer and use it in GitHub Desktop.
[ Posted by JimmyLi ] if - elseif - random
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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. "."); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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