Lucas Lucas - 9 months ago 40
PHP Question

How can I limit the max value of number?

I want to secure my page by checking if the value is digital (0,1,2,3) and if it is in the range from 0 to 120. I think

function limits numbers, so can not be passed any negative number. How can I limit the max value in the simplest way?

if (!ctype_digit($_GET['category'] AND ...) die('');

if (!ctype_digit($_GET['category'] > 120) ?

I was thinkig about
but it can pass negative numbers.

if (!ctype_digit($_GET['category']) || $_GET['category'] > 120) die('')

Basically this says "If it's not a number or if it's larger than 120, stop"