$sortBy = ($_POST['sortBy']) ? $_POST['sortBy'] : ($_GET['sortBy']) ?
$_GET['sortBy'] : 1;
[/PHP]
This script should set $sortBy to the $_POST or the $_GET or the
default of 1 in one line.
I do not want to have to do this:
[PHP]
if ($_POST['sortBy']) {
$sortBy = $_POST['sortBy'];
} elseif ($_GET['sortBy']) {
$sortBy = $_GET['sortBy'];
} else {
$sortBy = 1;
}
[/PHP]
This is too bloated for the 2000-line script I already have, and I
want to master ternary operators as I have never done so in 7 years.
I simply want the ternary operator equivalent of:
if - elseif - elseNOT
If - elseas the default..
Thanx
Phil