3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $foo = 's a c dd a'; $bar = str_replace(' ', '', $foo); $arr = array(); for($i = 0; $i <= strlen($bar); $i++) { array_push($arr, $bar[$i]); } var_dump($arr);
Output for 5.2.10 - 7.1.0
Notice: Uninitialized string offset: 6 in /in/A6jDb on line 8 array(7) { [0]=> string(1) "s" [1]=> string(1) "a" [2]=> string(1) "c" [3]=> string(1) "d" [4]=> string(1) "d" [5]=> string(1) "a" [6]=> string(0) "" }
Output for 4.3.0 - 5.2.9
Notice: Uninitialized string offset: 6 in /in/A6jDb on line 8 array(7) { [0]=> string(1) "s" [1]=> string(1) "a" [2]=> string(1) "c" [3]=> string(1) "d" [4]=> string(1) "d" [5]=> string(1) "a" [6]=> string(0) "" }