3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "This is a string"; $words = explode(" ", $str); $spaces=array(); $others=array(); foreach($words as $word) { if($word==' ') { array_push($spaces,$word); } else { array_push($others,$word); } } var_export([ 'words' => $words, 'spaces' => $spaces, 'others' => $others ]);

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
156.31 ms | 2079 KiB | 11 Q