Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
PHP procédural - Les conditions
$weapons = ['fists', 'whip', 'gun'];
$opponentWeapon = $weapons[rand(0,2)]; // Cela permet de choisir une arme de manière aléatoire.
$indyWeapon = $weapons;
if ($opponentWeapon == $weapons[0]){
$indyWeapon = $weapons [2];
}elseif ($opponentWeapon == $weapons [1]){
$indyWeapon = $weapons [0];
$indyWeapon = $weapons [1];
echo $indyWeapon;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.