eRott Posted April 3, 2008 Share Posted April 3, 2008 Okay, I have having a bit of trouble. I have an array contain 6 strings of numbers. I want to randomly pick one of these strings of numbers and output that chosen string. My problem is, it does not output the string, it will output a single number. What am I doing wrong? $folders = array("150593", "234156", "326514", "463152", "523574", "642552"); $folder = array_rand($folders, 1); $target = "path/".$folder; Take care. Quote Link to comment Share on other sites More sharing options...
craygo Posted April 3, 2008 Share Posted April 3, 2008 it is because array_rand returns the key not the value $folders = array("150593", "234156", "326514", "463152", "523574", "642552"); $i = array_rand($folders, 1); $target = "path/".$folders[$i]; Try that Ray Quote Link to comment Share on other sites More sharing options...
eRott Posted April 3, 2008 Author Share Posted April 3, 2008 Worked. Thank you. Take care. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.