So Wednesday I started my new job as a php developer. It’s been way awesome so far. One of the neat things I learned is the tertiary statement/operator which looks something like this ((condition_to_test)?if_true_do_this:if_false_do_this);. Here’s an example:
1 | ((isset($_POST[something]))?yes:no); |
If the the above statement is true then it returns a yes, otherwise it returns a no. Can’t really think of a good example for it, but it works kind of like an IF statement, especially when you just need to test something boolean-like style.