- Feb 28, 2010
- 5,501
- 4,420
Hey guys I just need a little bit of help! Basically I have a random array like this for example:
What I want to do from this is create another variable based on what gets picked. So I'm thinking an if statement.
Any help is appreciated!
Code:
<?php
$animalarray = array("cat", "dog", "beast", "lizard", "horse", "lion");
$random_animal = $animalarray[array_rand($animalarray)];
?>
<?php
echo "I recognize the $random_animal" ?>
What I want to do from this is create another variable based on what gets picked. So I'm thinking an if statement.
Any help is appreciated!