Re[2]: [PHP-DEV] New construct discussion Summary
| From: | Rasmus Lerdorf | Date: | Mon, 12 Jul 2004 02:48:06 +0000 |
| Subject: | Re[2]: [PHP-DEV] New construct discussion Summary | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-11104@lists.php.net to get a copy of this message | ||
On Sun, 11 Jul 2004, Jason Garber wrote:
> The concept is desirable, but can be achieved if you need it just as
> simply using already available syntax (ie a cast):
>
> $level = (integer) value($_SESSION['level'], 1);
The problem with that is this:
$level = (int) value($_SESSION['level');
Assume there is no level entry in the session array. This then
effectively becomes:
$level = (int) NULL;
Guess what that gives you? Obviously not what we want here which is why
we are talking about a mechanism to not cast that default value whether it
be the unspecified NULL default, or whatever default is passed in.
-Rasmus