Re: snippet

From: Date: Tue, 05 Aug 2003 22:40:55 +0000
Subject: Re: snippet
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-158260@lists.php.net to get a copy of this message
hi It is a Ternary Operator, Often you can avoid large if/else statements in your code by using the ternary operator. For example: echo "You have $i ". ($i==1 ? "message" : "messages"). " in your box.\n"; Note: "? : " operator has this syntax "expr ? expr : expr;" imran ----- Original Message ----- From: "Harry Wiens" <h.wiens@gmx.net> To: <php-general@lists.php.net> Sent: Tuesday, August 05, 2003 3:26 PM Subject: [PHP] snippet > can someone explain this for me: > ... > $sFont =submit("font") ? SITE_ROOT . PROG_PATH . submit("font") : > ""; > ... > > mfg. > hwiens > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#158260) next »