SPL ArrayAccess offsetExists default behavior
| From: | Mark van der Velden | Date: | Tue, 13 Jan 2009 15:43:58 +0000 |
| Subject: | SPL ArrayAccess offsetExists default behavior | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-42606@lists.php.net to get a copy of this message | ||
Hi list,
The following doesn't strike me as consistent behavior:
$a = new ArrayObject();$a["foobar"] = NULL; echo (int) isset( $a["foobar"] ); // Output: 1 While it's technically correct, I find it confusing. The reason is probably because of a array_key_exists (or property_exists) check within offsetExists() that do not take return false on a NULL value, unlike isset(). What say you ? - Mark