PHP Coding tips & tricks. Function & error explanation, coding style, how tos etc. Short notes posted directly from developer work environment.
PHP Coding Tips
Friday, August 10, 2012
How to randomize array in PHP ?
If you want to random order of elements in your php array, use shuffle function:$somethings = array();
$somethings[0] = "element1";
$somethings[1] = "element2";
$somethings[2] = "element3";
shuffle( $somethins );Notice that this will modify that array wich you put as a argument (pass by reference)
No comments:
Post a Comment