If you do not know what the Ternary operator is, or do not use it while you are coding, let me be the first to tell you how much you are missing out!

The Ternary operator looks like this: “?“, that’s right, it’s a question mark!

My favourite way of using it is to shorten Conditional If Statements, so let me show you what I’m on about.

The long way:
if ($someVariable==true) {
$someOtherVariable=1;
} else {
$someOtherVariable=2;
}

The slightly shorter way:
if ($someVariable==true) $someOtherVariable=1;
else $someOtherVariable=2;

The Ternary Operation way:
$someOtherVariable = ($someVariable) ? 1 : 2;

So this is how it works:
$result = ($condition) ? $ifTrue : $ifFalse;

This can also be used while outputting a string on runtime, I will show this using some javascript:
function aFunction(arg1,arg2) {
this.arg1 = arg1;
this.arg2 = arg2;
}
function printIt() { with (this) document.write(arg1+' > arg2 '+(arg2?'isTrue':'isFalse')+' arg2'); }
something=new aFunction('FooBar',true);
something.printIt();

If you did not know this or were not sure how it worked, then I’m sure you will now start using it in your code, it really does save time and it looks quite snazzy too!