I'm using the explode function and how would I be able to select 3 random arrays from it?
[man]explode/man returns a one dimensional array, so you cannot really select 3 random arrays from its return value. What you could do is use [man]array_rand/man to select 3 random entries from the array returned by explode().
We might need some clarification, as explode() only creates 1 array. Are you perhaps asking how to select 3 random elements from that array?
PS: Looks like LL hit submit while I was still typing. 🙂
<?php echo $string = "here/is/a/string/separated/by/slashes"; echo "<br />"; $exploded = explode("/",$string); $randomkeys = array_rand($exploded,3); foreach ($randomkeys as $key){ echo $exploded[$key]."<br />"; } ?>