Re: [PHP] Control Structure Syntax Question

2004-03-10 Thread Michal Migurski
>$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

Re: [PHP] Control Structure Syntax Question

2004-03-09 Thread trlists
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)

Re: [PHP] Control Structure Syntax Question

2004-03-09 Thread Justin Patrin
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

Re: [PHP] Control Structure Syntax Question

2004-03-09 Thread Ahbaid Gaffoor
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

Re: [PHP] Control Structure Syntax Question

2004-03-09 Thread Richard Davey
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

Re: [PHP] Control Structure Syntax Question

2004-03-09 Thread daniel
$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

[PHP] Control Structure Syntax Question

2004-03-09 Thread Ahbaid Gaffoor
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