Given the 3 variables below, each ending in a number. I want to echo out a random one of them by using the mt_rand(1,3) at the end of $fruit, so php randomly outputs one of the 3.
<?php
$fruit1 = 'apple';
$fruit2 = 'banana';
$fruit3 = 'orange';
echo $fruit.mt_rand(1,3);
I can do it easily with an array, but I want to know how to get the above working. Any idea?