Posted by Janwillem Borleffs on 05/05/06 13:05
Janwillem Borleffs wrote: > One way would be to apply casting: > > $num = "0.005"; > $num2 = "a0.005"; > > print (float) $num ? 1 : 0; // prints 1 > print (float) $num2 ? 1 : 0; // prints 0 > > Or a regexp, which would also catch 0.00: if (preg_match("/^\d+\.\d+$/", $num)) { // OK } JW
[Reply to this message]
Copyright © 2005-2006 Powered by Custom PHP Programming