FREE Web Template Download
HTML CSS JAVASCRIPT SQL PHP BOOTSTRAP JQUERY ANGULARJS TUTORIALS REFERENCES EXAMPLES Blog
 

PHP filter-SANITIZE_URL Filter


PHP Filter Reference Complete PHP Filter Reference

Definition and Usage

The filter-SANITIZE_URL filter removes all illegal URL characters from a string.

This filter allows all letters, digits and $-_.+!*'(),{}|\\^~[]`"><#%;/?:@&=

  • Name: "url"
  • ID-number: 518

Example

<?php
$var="http://www.w3schooċĝls.coĝm";

var_dump(filter-var($var, filter-SANITIZE_URL));
?>

The output of the code will be:

string(24) "http://tutorials"

PHP Filter Reference Complete PHP Filter Reference