$sortBy = ($_POST['sortBy']) ? $_POST['sortBy'] : ($_GET['sortBy']) ? $_GET['sortBy'] : 1;
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:
if ($_POST['sortBy']) {
$sortBy = $_POST['sortBy'];
} elseif ($_GET['sortBy']) {
$sortBy = $_GET['sortBy'];
} else {
$sortBy = 1;
}
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:
NOT
as the default..
Thanx
Phil