Axcelcius Posted December 6, 2007 Share Posted December 6, 2007 I just need to know the purpose and how to structure the '?' and ':' in PHP. I have run across a few functions that utilize them in what looks to be IF ELSE statements but I don't quite understand how to use them. Quote Link to comment Share on other sites More sharing options...
Orio Posted December 6, 2007 Share Posted December 6, 2007 You are talking about the ternary operator... Check the manual about it: http://www.php.net/operators.comparison (Scroll down a bit) Orio. Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted December 6, 2007 Share Posted December 6, 2007 Don't go crazy with them... they are helpful in certain places, but not many. While it seems to condense the code, it also makes it a major PITA to trouble shoot the code if the code is littered with these things. You should fully write out your IF logic... PhREEEk Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.