1.2.3
On my subsequent processing page I want to make sure the EU entered a numeric-only version number, with the exception of the periods. So, I've got the following function in an include file:
Code: Select all
<?php
function validate_version($version) {
$versArray = split('[.]', $version);
$num = count($versArray);
for ($i=0; $i<$num; $i++) {
return is_numeric($versArray[$i]);
}
}
?>Code: Select all
<?php
if (!validate_version($_POST['currentVersion'])) {
$error_code = "invalid version number";
}
?>1.2.3
it allows it (which is correct). If I enter
1.2.b
it also allows it (which is incorrect). What am I doing wrong?