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.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
Warning: Undefined array key "priceweek" in /in/CDed5 on line 14 Warning: Undefined array key "priceweek" in /in/CDed5 on line 14

preferences:
79.86 ms | 407 KiB | 5 Q