Re: what happened to that new isset() like language
| From: | Curt Zirzow | Date: | Fri, 09 Jul 2004 06:11:56 +0000 |
| Subject: | Re: what happened to that new isset() like language | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-11013@lists.php.net to get a copy of this message | ||
* Thus wrote Marc Richards:
>
>
> Jason Garber wrote:
>
>
> I am interested in the new construct for the exact same reason, E_ALL
> development. I am intersted in the ?: operator because it looks alot
> simpler, especially if you want to chain them together:
>
> $user = $_SESSION['user] ?: $_POST['user'] ?: $local_user ?: NULL;
At this point, might as well make the Or operator silence E_NOTICE
warnings:
$user = $_SESSION['user] Or $_POST['user'] Or $local_user Or NULL;
at least it would be readable.
The biggest problem I have with using ?: is that down the line we
might just have something like:
$foo = $bar ?%@*&!: $qaz
Inventing operators that consist more than one character can lead
to trouble.
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!