Jump to content

[SOLVED] Arrays: Choose Random Element


eRott

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/99401-solved-arrays-choose-random-element/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.