I want to incorporate some validation in the code that's processing some incoming form data. I need to make sure that a value coming in is either an integer or a decimal. Here's what I've got:
$number = 32,;
This will work for either a regular number of a decimal, but...
...if the user makes the mistake of including a "," or anything bogus, rather than the script returning "nope," I get an error that says, "arse error: syntax error, unexpected ',' in C:\wamp64\www\adm\jquery.php on line 8." Line #8 being $number = 32,;
How can I trim or qualify the incoming value so if there's something ridiculous coming in, it won't even try to evaluate it? In other words, what can I do before I even attempt to discern whether the value is an integer to ensure that I'm not going to get an error before I even start?