Hi everyone
Well I've started learning php yesterday and now I encountered my first problem, I looked around but I don't really know what to search for if I want my answer so here I come
<html>
<body>
<?php
$names = array('Peter','Quagmire','Joe');
$ages = array("Peter"=>32, "Quagmire"=>30, "Joe"=>34);
$who = rand(0,2);
$who2 = $names[$who];
echo "$names[$who] is $ages[$who2] years old";
?>
</body>
</html>
This is the script I have, and there is the kind of script I expected:
<html>
<body>
<?php
$names = array('Peter','Quagmire','Joe');
$ages = array("Peter"=>32, "Quagmire"=>30, "Joe"=>34);
$who = rand('Peter','Quagmire','Joe');
echo "$who is $ages[$who] years old";
?>
</body>
</html>
But after some search I concluded that rand is only used for random numbers
So, my question is, which function should I use to achieve my goal? Is there any randstring('string1','string2',etc) command?
Tnx for your time