Is there such a thing?
for eg
$var = -5; echo thefunction($var); // should be 0 $var = 5; echo thefunction($var); // should be 5
Try max($var,0)
, which will have the desired effect. See the manual page for more information.
Not built-in but, here you have:
function thefunction($var){ return ($var < 0 ? 0 : $var); }
Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With