3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array("3","4","5"); $array_of_keys = array_rand($array, 3); print_r($array_of_keys);
Output for 4.3.1, 4.3.3 - 4.3.4, 4.3.9, 5.0.1, 5.0.5, 5.2.2, 5.2.10 - 5.6.28, 7.0.0 - 7.1.0
Array ( [0] => 0 [1] => 1 [2] => 2 )
Output for 4.3.10, 5.1.1, 5.1.4, 5.1.6, 5.2.6, 5.2.9, hhvm-3.12.0
Array ( [0] => 2 [1] => 1 [2] => 0 )
Output for 4.3.5, 4.3.7, 4.4.0, 4.4.4, 4.4.6, 5.2.1, 5.2.7, hhvm-3.10.0
Array ( [0] => 2 [1] => 0 [2] => 1 )
Output for 4.4.2 - 4.4.3, 4.4.8, 5.2.3 - 5.2.4, 5.2.8
Array ( [0] => 1 [1] => 0 [2] => 2 )
Output for 4.3.0, 4.3.2, 4.4.5, 4.4.7, 4.4.9 - 5.0.0, 5.1.5, 5.2.0, 5.2.5
Array ( [0] => 1 [1] => 2 [2] => 0 )
Output for 4.3.6, 4.3.8, 4.3.11, 4.4.1, 5.0.2 - 5.0.4, 5.1.0, 5.1.2 - 5.1.3
Array ( [0] => 0 [1] => 2 [2] => 1 )