waUrlValidator

Contents...

Methods

  • isValid

    Checks whether a string is a valid URL.

public function isValid ($value)

Checks whether a string is a valid URL.

Parameters

  • $value

    String to be checked for being a correct URL.

Example

$validator = new waUrlValidator();

wa_dump(
    $validator->isValid('http://domain.com'),                 // true
    $validator->isValid('http://domain.com/path/'),           // true
    $validator->isValid('http://domain.com/path/?'),          // true
    $validator->isValid('http://domain.com/path/?param'),     // true
    $validator->isValid('http://domain.com/path/?param='),    // true
    $validator->isValid('http://domain.com/path/?param=1'),   // true
    $validator->isValid('https://domain.com/path/?param=1'),  // true
    $validator->isValid('domain.com/path/?param=1')           // false
);