If it's important to use the ternary operator, you can accomplish what
you want like this:

$var = condition ? this : $var;

While the end result is the same, this is not quite the same as

    if(condition) { $var = this;}

because in the ternary version, $var is assigned a new value either
way (although if the condition is false, it is re-assigned the same
value) -- but in the "if" version, $var is only acted on when
condition is true.

Regards,

Dave

>
> Can you do this syntax…
>
>         $var = condition ? this : that;
>
>
> …without the that? Like this…
>
>         $var = condition ? this;
>
>
> …? If yes, would it be the same as…
>
>         if(condition) {
>                 $var = this;
>         }


_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to