It is called the ternary operator.
PHP Code:
// something to evaluate ? 'value if true' : 'value if false';
$t = 'A';
//$t = 'B';
echo preg_match('/A/', $t) ? 'match' : 'no match';
Used inside the echo statement above, it says: Depending on whether or not preg_match() is true or false (1 or 0), echo match or no match. If preg_match() returns 1, the word 'match' is echoed. If preg_match() returns 0, the words 'no match' will be echoed.
Used inside your example, it says, if the constant APP_ROOT_PATH has been defined, set the $app_root_path variable equal to the value of the APP_ROOT_PATH constant. If APP_ROOT_PATH has not been defined, set the variable to './' Since the function defined() returns true or false, the ternary operator (?) can either use the first value after it if true, or the second, if false.
Bookmarks