A programmer's paradise created by the twist of deliberated fantasies, and actions of a determined imagination.
Follow ME:
Our world is now compressed, made tiny, and is traveling inside its axis called the "network". Her images are displayed in the screen of a PC monitor, and inside, people can meet there ... Through my programs and applications.

Add to Google
Batch-After-Batch Multi Uploader (FLASH)
The normal way of browsing files and uploading them. You can select multiple files from a single directory browsing. If you have browsed a f ...

The Ternary Conditional Operation in PHP

The ternary conditional operators are the ? and :

To demonstrate its use, first, we define our problem.
For example, our problem is to compare 2 numbers. If the first number is greater than the second, we will prompt "Hello", else, we say "Hi".

So here's the solution using If and Else statement:

$a = 4;
$b = 9;

if($a > $b)
   echo "Hello";
   echo "Hi";

In Ternary Operation, the solution is this:

echo ($a > $b) ? "Hello" : "Hi";

Ternary Operation explained: If the value of the first subexpression is TRUE (non-zero), then the second subexpression is evaluated, and that is the result of the conditional expression. Otherwise, the third subexpression is evaluated, and that is the value.