3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class evil { public function __toString() { global $array; $array[1] = 4; $array[] = 1; $array[] = 1; $array[] = 1; return "okey"; } } $array = range(0, 5); $array[1] .= new evil; var_dump($array);
based on EXKN8
Output for 7.0.0 - 7.2.0
array(9) { [0]=> int(0) [1]=> int(4) [2]=> int(2) [3]=> int(3) [4]=> int(4) [5]=> int(5) [6]=> int(1) [7]=> int(1) [8]=> int(1) }
Output for 5.3.22 - 5.6.28
array(9) { [0]=> int(0) [1]=> string(5) "1okey" [2]=> int(2) [3]=> int(3) [4]=> int(4) [5]=> int(5) [6]=> int(1) [7]=> int(1) [8]=> int(1) }