I have a problem that includes finding the maximums and minimums of certain variables in sequence. I want to nest the max() and min() functions as follows.
$variable5 = min(max(($variable1 - $variable0), 0), $variable3);
The PHP manual says/suggests that this type of nesting is possible. However, the code doesn't run correctly. It only runs correctly when I split up the nesting as follows.
$variable2 = max(($variable1 - $variable0), 0);
$variable5 = min(variable2, $variable3);
I have not been able to find any other examples of what I want to do. Does anyone have experience with this? Can you offer any suggestions? It is a rather long program so I would prefer to write code that is as succinct and concise as possible. (ie. 1 line of compact code rather than 2 lines of code with an extra variable.)
Thanks in advance.