3v4l.org

run code in 300+ PHP versions simultaneously
<?php class IterableClass implements ArrayAccess { private array $data = []; public function offsetExists(mixed $offset): bool { return true; } public function offsetGet(mixed $offset): mixed { return $this->data[$offset]; } public function offsetSet(mixed $offset, mixed $value): void { } public function offsetUnset(mixed $offset): void { } } $seasonsData = [new IterableClass(), new IterableClass()]; foreach ($seasonsData as $s) { echo isset($s['priceweek']) ? $s['priceweek'] : ''; }
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Warning: Undefined array key "priceweek" in /in/CDed5 on line 14 Warning: Undefined array key "priceweek" in /in/CDed5 on line 14

preferences:
109.77 ms | 402 KiB | 91 Q