3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $vowels = array('a','e','i','o','u'); $other = array(); $prev = null; for ($x=0,$s=null,$s=null;$x<4;$x++) { if (in_array($prev, $other)) { $s .= array_rand($vowels); } else { $s .= array_rand($other); } $prev = $s; } echo $s;
Output for 7.1.0
Warning: array_rand(): Array is empty in /in/sIBtM on line 11 Warning: array_rand(): Array is empty in /in/sIBtM on line 11 Warning: array_rand(): Array is empty in /in/sIBtM on line 11 Warning: array_rand(): Array is empty in /in/sIBtM on line 11
Output for 4.3.0 - 5.6.28, 7.0.0 - 7.0.14
Output for hhvm-3.10.0 - 3.12.0
Warning: Second argument has to be between 1 and the number of elements in the array in /in/sIBtM on line 11 Warning: Second argument has to be between 1 and the number of elements in the array in /in/sIBtM on line 11 Warning: Second argument has to be between 1 and the number of elements in the array in /in/sIBtM on line 11 Warning: Second argument has to be between 1 and the number of elements in the array in /in/sIBtM on line 11