3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ArrayAccessObject implements ArrayAccess { public function offsetSet($offset, $value){} public function offsetUnset($offset){} public function offsetExists($offset){} public function offsetGet($offset){ echo gettype($offset) . "\n"; } } $array = ['a', 'b', 'c']; $object = new ArrayAccessObject(); $string = '1'; $object[1]; // 'integer' $object['1']; // 'integer' <-- should be string $object[1.0]; // 'double' $object[true]; // 'boolean' $object[$string]; // 'string' $object[$object]; // 'object' $object[$array]; // 'array'

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
164.48 ms | 2280 KiB | 8 Q