Here is some sample code I got from PHP.net (I think) that will validate numbers. It is looking for any characters other than 0 - 9. I am not sure what happens with real numbers, I have not tried a decimal place. Give it a try. Hopefully it is a good start.
if(preg_match("/[^0-9\ ]+$/", $my_var)){// this is not a number, so do something}