[PHP] Making sure a variable is an integer

Soldato
Joined
4 Jul 2004
Posts
2,647
Location
aberdeen
I know its just a simple function, can't remember or find what it is.

Need to make sure that for example ...
PHP:
$id = $_GET['id']
is always ONLY an integer. I've done it but it requires 3 if statements, i'm know i had a (built in) function that worked a while ago but can't remember it.

Thanks :D
 
Thanks for your replies.

This is something I've never worked out with PHP... In Java or whatever, you always define if something is for example a string, int etc. How do you do this sort of thing in PHP?

When i set $example = "1", would that, like that, be a string? Or an integer?

Thanks
 
Back
Top Bottom