3v4l.org

run code in 300+ PHP versions simultaneously
<?php function accept_array($a) : void { var_dump($a); unset($a); } function return_array() { return new class implements ArrayAccess { public function offsetExists(mixed $offset): bool { return true; } public function offsetGet(mixed $offset): mixed { return 42; } public function offsetSet(mixed $offset, mixed $value): void {} public function offsetUnset(mixed $offset): void {} }; } $input = return_array(); if (isset($input['key'])) { accept_array($input); }

preferences:
38.46 ms | 404 KiB | 5 Q