Created
March 24, 2022 21:55
-
-
Save sele-nap/4061f8b79c4ee59401bde8b86734bb27 to your computer and use it in GitHub Desktop.
WCS quest // 5. Les conditions en PHP
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 | |
$weapons = ['fists', 'whip', 'gun']; | |
$opponentWeapon = $weapons[rand(0,2)]; | |
switch ($opponentWeapon) { | |
case 'fists' : | |
$indyWeapon = 'gun'; | |
break; | |
case 'whip' : | |
$indyWeapon = 'fists'; | |
break; | |
case 'gun' : | |
$indyWeapon = 'whip' ; | |
break; | |
} | |
echo "The enemy attacks with : -$opponentWeapon- ... Indi counterattacks with -$indyWeapon- ! "; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment