3v4l.org

run code in 300+ PHP versions simultaneously
<?php $errors = new class { protected $errors = []; function __toString() : string { return EOL . "Problems: ========================" . EOL . EOL . implode(EOL, $this->errors) . EOL ; } function __count() : int { return count($this->errors); } function add(string $error){ $this->errors[] = $error; } function all() : array { $this->errors; } } ; var_dump(count($errors)); var_dump($errors);

preferences:
34.24 ms | 402 KiB | 5 Q