3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str = "1 -4 5 6 -2"; $e = ""; $m = "-"; for($i = 0, $len = strlen($str); $i < $len; $i++) { if($m == $str[$i]) { $e = $m; } else { $e = ""; } if(is_numeric($str[$i])) { $result[] = $e . $str[$i]; } } echo $result;
Output for 5.6.30, hhvm-3.15.4 - 3.21.3, 7.0.0 - 7.2.9
Notice: Array to string conversion in /in/MNIG5 on line 18 Array
Output for hhvm-3.22.0
Notice: Array to string conversion in /in/MNIG5 on line -1 Array