3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bar implements Iterator { protected $offset = 0; function key(){ throw new Exception("collection doesn't have a key"); } function rewind(){ $this->offset = 0; } function next(){ $this->offset++; } function current(){ return "thank u baby jesus"; } function valid(){ return $this->offset <= 5; } } foreach(new Bar as $value){ var_dump($value); }

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
165.98 ms | 3494 KiB | 11 Q