Too much work.
First, I want to point out that whilst
is not an operator,
is an operator. It wouldn't help you here at all though, if you attempt to left shift over 32 in PHP, you'll end up with unusual results since PHP only interprets numbers to 32 bits. I believe this applies to any precompiled version of PHP, although if you compile it yourself for x64, you *may* be able to go larger (I can't be sure on that, but last I checked the union for zval was using a long).
You don't actually need as many brackets as you may think with using ternaries. The problem simply comes to how the ternary acts in the current context it is working in.
print isset($_GET['a']) && $_GET['a'] != 0 ? $_GET['a'] / 235 : 0.0;
It will also work with an assignment, so this is actually valid:
$age = isset($a['a']) && $a['a'] != 0 ? $a['a'] / 235 : 0.0; // use 0.0 as your default as you are working with a float as end result.
However, do note that it is actually a VERY good idea to use brackets around these in PHP, in particular the ENTIRE ternary. The reason why is that in PHP ternary operations use left to right assignment of operators, while pretty much every other language uses right to left precedence for ternary. This becomes apparent if you move a ternary into using nested ternaries, or concatenated into a string. A quick example of that:
// In C this is how it should work:
int main(int argc, char **argv)
char *a = "cat";
// below will print "It's a CAT!"
printf("It's a %s!",
strcmp(a, "cat") == 0 ? "CAT" :
strcmp(a, "dog") == 0 ? "DOG" :
strcmp(a, "mouse") == 0 ? "MOUSE" :
And in PHP:
$a = "cat";
// below will print "It's a MOUSE!"
printf("It's a %s!",
strcmp($a, "cat") == 0 ? "CAT" :
strcmp($a, "dog") == 0 ? "DOG" :
strcmp($a, "mouse") == 0 ? "MOUSE" :
So clearly that's not correct.
Down to the ifs. You don't need to create ranges when you are working with them. Simply blanket them with less than or greater than and work in the proper order. So for counting up, you'd blanket using <. It doesn't *quite* fit into what you have here since there is no case for < 30, but I'll make one up.
if ($age < 30)
else if ($age < 40)
print('30 - 39');
else if ($age < 50)
print('40 - 49');
Now since you are working by ignoring the < 30 range, it may be wiser to compare backwards and work down from 50+. That way you don't need to use an else to blanket the < 30.