PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php /*$abc = array( "h" => array('1','2','3'), "d" => array('4','5','6') );*/ $abc = [ '431600986' => [ 'range' => [ 'to' => 1, 'from' => 1 ] ], '795276879' => [ 'range' => [ 'to' => 4, 'from' => 2 ] ] ]; $r = Array(); foreach($abc as $k => $v){ for ($i = $v['range']['from']; $i <= $v['range']['to']; $i++) { $newArr[$k][] = $i; } } foreach($newArr as $k => $v){ $r[$k] = $v[mt_rand(0,count($v)-1)]; } echo '<pre>'; print_r( $newArr ); echo '</pre>'; echo '<pre>'; print_r( $r ); echo '</pre>';
Show:  
Copy Clear