Professional Documents
Culture Documents
Phonenumber Ethio$ Age$...
Phonenumber Ethio$ Age$...
Phonenumber Ethio$ Age$...
Validate Name
function validateName($name) {
return true;
return false;
Validate Age
function validateAge($age) {
if (preg_match("/^[0-9]+$/", $age)) {
return true;
return false;
Validate Price
Allowing only 2 digits after dot. Price can be decimal or without
decimal. 9 and 9.99 = both are true.
function validatePrice($price) {
if (preg_match("/^[0-9]+(\.[0-9]{2})?$/", $price)) {
return true;
return false;
}
Validate Email
function validateEmail($email) {
if (preg_match("/^[_a-z0-9-+]+(\.[_a-z0-9-+]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})
$/", $email)) {
return true;
return false;
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
return true;
return false;