On Saturday 26 January 2008 18:22:09 Sam Barrow wrote:
> I'm sorry I misunderstood. If specifying like "$var ?: 5" then it should
> throw an E_NOTICE, as this is a conditional that checks the value of a
> variable ($var).
>
> Sebastian, for assigning of a default value is a variable is not set, I
> would recommend using something like this (this is what I use):
>
> function ifsetor(&$var, $or) {
>       return isset($var) ? $var : $or ;
> }

That magically brings $foo into life if you do ifsetor($foo, 2).

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to