|
|
Joined: Mar 2000
Posts: 615
Member
|
Member
Joined: Mar 2000
Posts: 615 |
I just read about this in the PHP manual: $variable = ( expression1 ? expression2 : expression3); $variable will result in expression2 if expression1 evaluates to true, or expression3 if it is false. and then there's double, or even triple: ------------------ 
|
|
|
|
Joined: Sep 2000
Posts: 755
P.I.T.A. / Programmer
|
P.I.T.A. / Programmer
Joined: Sep 2000
Posts: 755 |
That's the ternary operator. Perl and other languages use it too.
--mark
"Annnnnnnndd now, opening for Iron Maiden...... WYLD STALLYNS!!!" --Bill S. Preston, Esquire and Ted "Theodore " Logan
|
|
|
|
Joined: Aug 2000
Posts: 3,590
Moderator
|
Moderator
Joined: Aug 2000
Posts: 3,590 |
Ternary = good, eh Mark? ![[Linked Image]](https://ubbdev.com/ubb/smilies/biggrin.gif) ------------------  :: Who is Andy? This message has been edited by atom911 on January 01, 2001 at 11:41 AM
|
|
|
|
Joined: Mar 2000
Posts: 615
Member
|
Member
Joined: Mar 2000
Posts: 615 |
I've seen it in Perl and stuff before, but I didn't know PHP had it. ------------------ 
|
|
|
|
Joined: Feb 1999
Posts: 1,379
Programmer
|
Programmer
Joined: Feb 1999
Posts: 1,379 |
Allows for even tighter (and easier to read) code in perl. excellent. Just a thought ![[Linked Image]](https://ubbdev.com/ubb/smilies/smile.gif) ------------------ http://www.iamcal.com
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 1,157
Joined: July 2001
|
|
Forums63
Topics37,575
Posts293,932
Members13,824
|
Most Online6,139 Sep 21st, 2024
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|
|