user701510 user701510 - 1 year ago 82
PHP Question

how to check if PHP variable contains non-numbers?

I just want to know the method to check a PHP variable for any non-numbers and if it also detects spaces between characters? Need to make sure nothing weird gets put into my form fields. Thanks in advance.

Answer Source

If you mean that you only want a value to contain numbers then you can use ctype_digit().

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download