3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C implements ArrayAccess { public function offsetGet($offset) { return 'value'; } public function offsetExists($offset) { if ($offset == 'pWithNull') { return null; } if ($offset == 'pWithFalse') { return false; } if ($offset == 'pWithTrue') { return true; } return false; } public function offsetSet($offset, $value) { // nothing } } $o = new C(); var_dump( isset($o->pWithFalse), empty($o->pWithFalse) ); var_dump( isset($o->pWithNull), empty($o->pWithNull) ); var_dump( isset($o->pWithTrue), empty($o->pWithTrue) );

preferences:
37.9 ms | 402 KiB | 5 Q