- var_dump: documentation ( source)
- preg_match: documentation ( source)
<?php
$values = array(
0,
1,
'1',
1.00,
2.33,
3.445
-3.45
);
foreach($values as $value) {
$regexp = '/^[0-9]+.[0-9][0-9]?$/';
preg_match($regexp, $value, $matches);
var_dump($matches);
}