// acceptable: 1, 1.0, 1.23
// not acceptable 1.234
if (preg_match('/^[0-9]+(?:\.[0-9]{0,2})?$/', $input))
{
print "Amount is valid";
}
else
{
print "Amount is not valid<fish>";
}
// not acceptable 1.234
if (preg_match('/^[0-9]+(?:\.[0-9]{0,2})?$/', $input))
{
print "Amount is valid";
}
else
{
print "Amount is not valid<fish>";
}
I think this code will error out, you're missing the last parenthesis ')' for the if statement.