I would use
if (isset($_GET['ID']) && ($_GET['ID']+0>0)) {
echo (int)$_GET['ID']
}
with a casting to integer (int)
. If the value must be an integer.
powtac
2009-10-13 15:39:07
I would use
if (isset($_GET['ID']) && ($_GET['ID']+0>0)) {
echo (int)$_GET['ID']
}
with a casting to integer (int)
. If the value must be an integer.
i'd use a Request class that encapsulates all Php "superglobals" and provides methods like "param()", "numParam()", "arrayParam()" and so on.
$req = new Request();
$user_id = $req->numParam('id');
// user_id is guaranteed to be a valid integer or 0