Return to Snippet

Revision: 65404
at November 28, 2013 21:06 by codingforever99

Initial Code
function is_valid_url($url){
    $p1 ='/(http|https|ftp):\/\/[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(\/.*)?$/i';
    return preg_match($p1, $url); 

function is_valid_email($email){
    if (filter_var($email, FILTER_VALIDATE_EMAIL))
        return true;
        return false;

function is_valid_ip($ip){
    if (filter_var($ip, FILTER_VALIDATE_IP))
        return true;
        return false;


Initial URL

Initial Description
Simple PHP functions to validate url, email address and ip, functions will return TRUE for valid data and FALSE for invalid data.

Initial Title
url, email and ip validation with php

Initial Tags
email, url, php, validation, ip

Initial Language