Nieuw lid |
|
<?php
$nr = array("1", "1,1", "1,12", "1,123", "1,", "1.1", "1.12");
foreach($nr as $n)
{
if(!preg_match("~^[0-9]+(,[0-9]{1,2})?$~", $n))
{
echo $n.' is fout<br>';
}
else
{
echo $n.' is goed<br>';
}
}
?>
<?php $nr = array("1", "1,1", "1,12", "1,123", "1,", "1.1", "1.12"); foreach($nr as $n) { { } else { } } ?>
1 is goed
1,1 is goed
1,12 is goed
1,123 is fout
1, is fout
1.1 is fout
1.12 is fout |