preg_match need for accept only positive floating point numbers . Example: 1.5 or 10 and not for -1.5 or -10 values. Thanks in advance.
if(preg_match("/^\d+(?:\.\d+)?$/", $number)){
// do some process
}
Here (\.\d+)?
is checking for optional decimal point with digits!
?:
is used to avoid capturing the group.