3v4l.org

run code in 500+ PHP versions simultaneously
<?php namespace App; use ArrayIterator; final class PropertySameNameAsVariable { public ArrayIterator $items; public function run() { $items = ['apple']; return array_merge($this->items, $items); } } $a = new PropertySameNameAsVariable(); $a->items = new ArrayIterator([]); $a->run();
Output for 8.3.35
Fatal error: Uncaught TypeError: array_merge(): Argument #1 must be of type array, ArrayIterator given in /in/fsFR5:14 Stack trace: #0 /in/fsFR5(14): array_merge(Object(ArrayIterator), Array) #1 /in/fsFR5(20): App\PropertySameNameAsVariable->run() #2 {main} thrown in /in/fsFR5 on line 14
Process exited with code 255.

preferences:
26.65 ms | 1151 KiB | 6 Q