>$x ? xxx : xxx
>
>But it makes your code less readable IMHO and offers no tangible benefit
>whatsoever.
It offers the tangible benefit of evaluating to something:
return (isset($foo) ? $foo : $bar);
$query = "select * from foo"
.(isset($bar) ? " where bar = ${ba
On 9 Mar 2004 Richard Davey wrote:
> $x ? xxx : xxx
>
> But it makes your code less readable IMHO and offers no tangible
> benefit whatsoever.
Ah, to each his/her own I guess ... I actually find:
$value = ($condition ? $val1 : $val2);
easier to read than:
if ($condition)
Ahbaid Gaffoor wrote:
Yeah, but if my code is less readable, my job security goes up ;) (Kidding)
Thanks for all your help folks,
that's what I needed.
regards
Ahbaid
Richard Davey wrote:
Hello Ahbaid,
Tuesday, March 9, 2004, 11:42:21 PM, you wrote:
AG> Someone had posted a tip for using a
Yeah, but if my code is less readable, my job security goes up ;) (Kidding)
Thanks for all your help folks,
that's what I needed.
regards
Ahbaid
Richard Davey wrote:
Hello Ahbaid,
Tuesday, March 9, 2004, 11:42:21 PM, you wrote:
AG> Someone had posted a tip for using an abbreviated form of a
Hello Ahbaid,
Tuesday, March 9, 2004, 11:42:21 PM, you wrote:
AG> Someone had posted a tip for using an abbreviated form of an if.. else
AG> structure...
AG> It looked something like:
AG> $x : action1 : action2;
$x ? xxx : xxx
But it makes your code less readable IMHO and offers no tangible
b
$x ? action1 : action2;
> structure...
>
> It looked something like:
>
> $x : action1 : action2;
>
> I'm trying to shorten having to do the following:
>
> if ($x) {
> action1;
> } else {
> action 2;
> }
>
> can someone please post the syntax if they know it? I am reading the
> fine documentatio
Someone had posted a tip for using an abbreviated form of an if.. else
structure...
It looked something like:
$x : action1 : action2;
I'm trying to shorten having to do the following:
if ($x) {
action1;
} else {
action 2;
}
can someone please post the syntax if they know it? I am reading the
7 matches
Mail list logo