Created
June 15, 2012 00:38
-
-
Save kiyoto/2933917 to your computer and use it in GitHub Desktop.
creating random associative arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function random_array(&$current) { | |
foreach ($current as $k => &$v) { | |
if ((rand() % 10) / 10 >= 0.68) { | |
$v = array(0, 'aoiyu', 1337); | |
random_array($v); | |
} | |
} | |
unset($v); | |
} | |
$start = array(0,1,2); | |
random_array($start); | |
echo json_encode($start); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment