3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $input = array("Neo", "Morpheus", "Trinity", "Cypher", "Tank"); $rand_keys = array_rand($input,0); echo $input[$rand_keys] . "\n"; ?>
Output for 5.3.0 - 7.1.0
Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in /in/7htvD on line 3 Notice: Undefined index: in /in/7htvD on line 4
Output for 4.3.2 - 5.2.17
Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in /in/7htvD on line 3 Notice: Undefined index: in /in/7htvD on line 4
Output for 4.3.0 - 4.3.1
Warning: array_rand() [http://www.php.net/function.array-rand]: Second argument has to be between 1 and the number of elements in the array in /in/7htvD on line 3 Notice: Undefined index: in /in/7htvD on line 4