Re: repetition of tedious references
| From: | Olav Mørkrid | Date: | Wed, 18 Jul 2007 14:24:13 +0000 |
| Subject: | Re: repetition of tedious references | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-259119@lists.php.net to get a copy of this message | ||
i didn't know about empty. thanks!
do you have a link to this new php 6 ? : convention?
it would be great if php 6 could have a solution for this. php is
sweet when it's compact!
On 18/07/07, Arpad Ray <arpad@rajeczy.com> wrote:
You can use empty() to take one of them out, since "0" is presumably
also not a desired input:
$language = empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])
? "*"
: $_SERVER['HTTP_ACCEPT_LANGUAGE'];
There's a new ?: operator in PHP 6 which will make that even shorter,
however unlike empty(), it currently throws a notice with unset operands.