3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a=['x','y','z']; while(@$i++<count($a)) echo $a[$i-1]; echo "\n"; echo implode(null,$a); echo "\n"; foreach($a as $e) echo $e; echo "\n"; for($i=0;$i<count($a);$i++) echo $a[$i]; echo "\n"; function f($e){echo $e;} array_walk($a,"f"); echo "\n"; // for debugging var_dump($a); print_r($a);
Output for 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
xyz Deprecated: implode(): Passing null to parameter #1 ($separator) of type array|string is deprecated in /in/LsN83 on line 10 xyz xyz xyz xyz array(3) { [0]=> string(1) "x" [1]=> string(1) "y" [2]=> string(1) "z" } Array ( [0] => x [1] => y [2] => z )
Output for 5.6.38, 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
xyz xyz xyz xyz xyz array(3) { [0]=> string(1) "x" [1]=> string(1) "y" [2]=> string(1) "z" } Array ( [0] => x [1] => y [2] => z )

preferences:
153.55 ms | 403 KiB | 177 Q