News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

HashBangCode.com:
Revisiting filter_var() and FILTER_VALIDATE_URL
April 04, 2011 @ 08:44:45

From the HashBangCode.com site today there's a new post that revisits filtering with the filter_var function included with the language. The focus in this article is specifically in validating URLs with the FILTER_VALIDATE_URL flag.

Quite a while ago I looked at using the filter_var() function to validate URL's using the FILTER_VALIDATE_URL flag and someone pointed out recently that this function has not only changed since the initial release, but that a number of flags can be added to change the way that this function works.

He lists some of the other flags that are now available that can be used in conjunction with FILTER_VALIDATE_URL to get more fine-grained in your filtering - checks on things like a required scheme, hostname and query string. He includes some code with a set of URLs to run through some tests and output as a table with the pass/fail rank of each URL value. You can see the resulting output here.

0 comments voice your opinion now!
filtervar url filtervalidateurl scheme hostname path query


blog comments powered by Disqus

Similar Posts

Abhinav Singh's Blog: MySQL Query Cache, WP-Cache, APC, Memcache - What to choose

Davey Shafik's Blog: AJAX and PHP End-to-End Debugging

CodePoets.co.uk: A Quickstart to using PEAR with PHP

Tobias Schlitt's Blog: iRefuseToUse aNamingScheme

Davey Shafik's Blog: AJAX and PHP End-to-End Debugging


Community Events





Don't see your event here?
Let us know!


introduction community series language unittest podcast conference extension voicesoftheelephpant symfony list opinion laravel interview version configure api install composer release

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework