It's called the ternary operator, and works like this:

$VAL ? $VAL = "$VAL:$expr" : $VAL = "$expr";

IF_EXPR ? THEN_EXPR : ELSE_EXPR

Depending on context of how you are using it, I like to put the enter
statement in parens as in: ( ternary_statement )


-Jeff

--- Ravi Malghan <[EMAIL PROTECTED]> wrote:
> Hi: I have this statement which checks for existence
> of the $VAL variable and performs certain actions
> 
> if($VAL){
>   $VAL = "$VAL:$expr"; }
> else { 
>   $VAL = "$expr"; }
> 
> Can this 4 line statement be reduced to a single line
> using "?" operator?
> 
> Thanks
> Ravi
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - File online, calculators, forms, and more
> http://platinum.yahoo.com
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://platinum.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to