3v4l.org

run code in 300+ PHP versions simultaneously
<?php $instances_a = array( 'hello' => 'world' ); $instances_ao = new ArrayObject( $instances_a ); $instances_ai = new ArrayIterator( $instances_a ); foreach ( array( $instances_a, $instances_ao, $instances_ai ) as $instances ) { if ( ( is_array( $instances ) && array_key_exists( 'hello', $instances ) ) || isset( $instances[ 'hello' ] ) ) { echo "Exists\n"; } }
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
Exists Exists Exists

preferences:
74.93 ms | 406 KiB | 5 Q