3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $urls = array( 'http://www.website.com/path1/path2/file1.php?query1=true&query2=false', 'http://website.com/path1/path2/file1.php?query1=true&query2=false', 'http://website/path1/path2/file1.php?query1=true&query2=false', 'http://www.website.com/path1/path2/?query1=true&query2=false', 'http://website.com/path1/path2/?query1=true&query2=false', 'http://website/path1/path2/?query1=true&query2=false', 'http://www.website.com/path1/path2/', 'http://website.com/path1/path2/', 'http://website/path1/path2/', 'http://www.website.com?query1=true&query2=false', 'http://website.com?query1=true&query2=false', 'http://website?query1=true&query2=false', 'www.website.com/path1/path2/file1.php?query1=true&query2=false', 'website.com/path1/path2/file1.php?query1=true&query2=false', 'website/path1/path2/file1.php?query1=true&query2=false', 'www.website.com/path1/path2/?query1=true&query2=false', 'website.com/path1/path2/?query1=true&query2=false', 'website/path1/path2/?query1=true&query2=false', 'www.website.com/path1/path2/', 'website.com/path1/path2/', 'website/path1/path2/', 'www.website.com?query1=true&query2=false', 'website.com?query1=true&query2=false', 'website?query1=true&query2=false', ); $flags = array( null, FILTER_FLAG_SCHEME_REQUIRED, FILTER_FLAG_SCHEME_REQUIRED & FILTER_FLAG_HOST_REQUIRED, FILTER_FLAG_SCHEME_REQUIRED & FILTER_FLAG_HOST_REQUIRED & FILTER_FLAG_PATH_REQUIRED, FILTER_FLAG_SCHEME_REQUIRED & FILTER_FLAG_HOST_REQUIRED & FILTER_FLAG_PATH_REQUIRED & FILTER_FLAG_QUERY_REQUIRED ); foreach($urls as $url){ foreach($flags as $flag){ var_dump((bool) filter_var($url, FILTER_VALIDATE_URL, $flag)); } echo "<br/>"; }
Output for 5.2.1 - 5.6.21, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(false) bool(false) bool(false) bool(false) bool(false) <br/>bool(false) bool(false) bool(false) bool(false) bool(false) <br/>bool(false) bool(false) bool(false) bool(false) bool(false) <br/>bool(false) bool(false) bool(false) bool(false) bool(false) <br/>bool(false) bool(false) bool(false) bool(false) bool(false) <br/>bool(false) bool(false) bool(false) bool(false) bool(false) <br/>bool(false) bool(false) bool(false) bool(false) bool(false) <br/>bool(false) bool(false) bool(false) bool(false) bool(false) <br/>bool(false) bool(false) bool(false) bool(false) bool(false) <br/>bool(false) bool(false) bool(false) bool(false) bool(false) <br/>bool(false) bool(false) bool(false) bool(false) bool(false) <br/>bool(false) bool(false) bool(false) bool(false) bool(false) <br/>
Output for 5.2.0
bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(true) bool(true) bool(true) bool(true) <br/>bool(true) bool(false) bool(true) bool(true) bool(true) <br/>bool(true) bool(false) bool(true) bool(true) bool(true) <br/>bool(true) bool(false) bool(true) bool(true) bool(true) <br/>bool(true) bool(false) bool(true) bool(true) bool(true) <br/>bool(true) bool(false) bool(true) bool(true) bool(true) <br/>bool(true) bool(false) bool(true) bool(true) bool(true) <br/>bool(true) bool(false) bool(true) bool(true) bool(true) <br/>bool(true) bool(false) bool(true) bool(true) bool(true) <br/>bool(true) bool(false) bool(true) bool(true) bool(true) <br/>bool(true) bool(false) bool(true) bool(true) bool(true) <br/>bool(true) bool(false) bool(true) bool(true) bool(true) <br/>bool(true) bool(false) bool(true) bool(true) bool(true) <br/>
Output for 5.0.0 - 5.1.6
Notice: Use of undefined constant FILTER_FLAG_SCHEME_REQUIRED - assumed 'FILTER_FLAG_SCHEME_REQUIRED' in /in/Y3XIE on line 31 Notice: Use of undefined constant FILTER_FLAG_SCHEME_REQUIRED - assumed 'FILTER_FLAG_SCHEME_REQUIRED' in /in/Y3XIE on line 32 Notice: Use of undefined constant FILTER_FLAG_HOST_REQUIRED - assumed 'FILTER_FLAG_HOST_REQUIRED' in /in/Y3XIE on line 32 Notice: Use of undefined constant FILTER_FLAG_SCHEME_REQUIRED - assumed 'FILTER_FLAG_SCHEME_REQUIRED' in /in/Y3XIE on line 33 Notice: Use of undefined constant FILTER_FLAG_HOST_REQUIRED - assumed 'FILTER_FLAG_HOST_REQUIRED' in /in/Y3XIE on line 33 Notice: Use of undefined constant FILTER_FLAG_PATH_REQUIRED - assumed 'FILTER_FLAG_PATH_REQUIRED' in /in/Y3XIE on line 33 Notice: Use of undefined constant FILTER_FLAG_SCHEME_REQUIRED - assumed 'FILTER_FLAG_SCHEME_REQUIRED' in /in/Y3XIE on line 34 Notice: Use of undefined constant FILTER_FLAG_HOST_REQUIRED - assumed 'FILTER_FLAG_HOST_REQUIRED' in /in/Y3XIE on line 34 Notice: Use of undefined constant FILTER_FLAG_PATH_REQUIRED - assumed 'FILTER_FLAG_PATH_REQUIRED' in /in/Y3XIE on line 34 Notice: Use of undefined constant FILTER_FLAG_QUERY_REQUIRED - assumed 'FILTER_FLAG_QUERY_REQUIRED' in /in/Y3XIE on line 35 Fatal error: Call to undefined function filter_var() in /in/Y3XIE on line 39
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Notice: Use of undefined constant FILTER_FLAG_SCHEME_REQUIRED - assumed 'FILTER_FLAG_SCHEME_REQUIRED' in /in/Y3XIE on line 31 Notice: Use of undefined constant FILTER_FLAG_SCHEME_REQUIRED - assumed 'FILTER_FLAG_SCHEME_REQUIRED' in /in/Y3XIE on line 32 Notice: Use of undefined constant FILTER_FLAG_HOST_REQUIRED - assumed 'FILTER_FLAG_HOST_REQUIRED' in /in/Y3XIE on line 32 Notice: Use of undefined constant FILTER_FLAG_SCHEME_REQUIRED - assumed 'FILTER_FLAG_SCHEME_REQUIRED' in /in/Y3XIE on line 33 Notice: Use of undefined constant FILTER_FLAG_HOST_REQUIRED - assumed 'FILTER_FLAG_HOST_REQUIRED' in /in/Y3XIE on line 33 Notice: Use of undefined constant FILTER_FLAG_PATH_REQUIRED - assumed 'FILTER_FLAG_PATH_REQUIRED' in /in/Y3XIE on line 33 Notice: Use of undefined constant FILTER_FLAG_SCHEME_REQUIRED - assumed 'FILTER_FLAG_SCHEME_REQUIRED' in /in/Y3XIE on line 34 Notice: Use of undefined constant FILTER_FLAG_HOST_REQUIRED - assumed 'FILTER_FLAG_HOST_REQUIRED' in /in/Y3XIE on line 34 Notice: Use of undefined constant FILTER_FLAG_PATH_REQUIRED - assumed 'FILTER_FLAG_PATH_REQUIRED' in /in/Y3XIE on line 34 Notice: Use of undefined constant FILTER_FLAG_QUERY_REQUIRED - assumed 'FILTER_FLAG_QUERY_REQUIRED' in /in/Y3XIE on line 35 Fatal error: Call to undefined function: filter_var() in /in/Y3XIE on line 39
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Notice: Use of undefined constant FILTER_FLAG_SCHEME_REQUIRED - assumed 'FILTER_FLAG_SCHEME_REQUIRED' in /in/Y3XIE on line 31 Notice: Use of undefined constant FILTER_FLAG_SCHEME_REQUIRED - assumed 'FILTER_FLAG_SCHEME_REQUIRED' in /in/Y3XIE on line 32 Notice: Use of undefined constant FILTER_FLAG_HOST_REQUIRED - assumed 'FILTER_FLAG_HOST_REQUIRED' in /in/Y3XIE on line 32 Notice: Use of undefined constant FILTER_FLAG_SCHEME_REQUIRED - assumed 'FILTER_FLAG_SCHEME_REQUIRED' in /in/Y3XIE on line 33 Notice: Use of undefined constant FILTER_FLAG_HOST_REQUIRED - assumed 'FILTER_FLAG_HOST_REQUIRED' in /in/Y3XIE on line 33 Notice: Use of undefined constant FILTER_FLAG_PATH_REQUIRED - assumed 'FILTER_FLAG_PATH_REQUIRED' in /in/Y3XIE on line 33 Notice: Use of undefined constant FILTER_FLAG_SCHEME_REQUIRED - assumed 'FILTER_FLAG_SCHEME_REQUIRED' in /in/Y3XIE on line 34 Notice: Use of undefined constant FILTER_FLAG_HOST_REQUIRED - assumed 'FILTER_FLAG_HOST_REQUIRED' in /in/Y3XIE on line 34 Notice: Use of undefined constant FILTER_FLAG_PATH_REQUIRED - assumed 'FILTER_FLAG_PATH_REQUIRED' in /in/Y3XIE on line 34 Notice: Use of undefined constant FILTER_FLAG_QUERY_REQUIRED - assumed 'FILTER_FLAG_QUERY_REQUIRED' in /in/Y3XIE on line 35 Fatal error: Call to undefined function: filter_var() in /in/Y3XIE on line 39
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant FILTER_FLAG_SCHEME_REQUIRED - assumed 'FILTER_FLAG_SCHEME_REQUIRED' in /in/Y3XIE on line 31 Notice: Use of undefined constant FILTER_FLAG_SCHEME_REQUIRED - assumed 'FILTER_FLAG_SCHEME_REQUIRED' in /in/Y3XIE on line 32 Notice: Use of undefined constant FILTER_FLAG_HOST_REQUIRED - assumed 'FILTER_FLAG_HOST_REQUIRED' in /in/Y3XIE on line 32 Notice: Use of undefined constant FILTER_FLAG_SCHEME_REQUIRED - assumed 'FILTER_FLAG_SCHEME_REQUIRED' in /in/Y3XIE on line 33 Notice: Use of undefined constant FILTER_FLAG_HOST_REQUIRED - assumed 'FILTER_FLAG_HOST_REQUIRED' in /in/Y3XIE on line 33 Notice: Use of undefined constant FILTER_FLAG_PATH_REQUIRED - assumed 'FILTER_FLAG_PATH_REQUIRED' in /in/Y3XIE on line 33 Notice: Use of undefined constant FILTER_FLAG_SCHEME_REQUIRED - assumed 'FILTER_FLAG_SCHEME_REQUIRED' in /in/Y3XIE on line 34 Notice: Use of undefined constant FILTER_FLAG_HOST_REQUIRED - assumed 'FILTER_FLAG_HOST_REQUIRED' in /in/Y3XIE on line 34 Notice: Use of undefined constant FILTER_FLAG_PATH_REQUIRED - assumed 'FILTER_FLAG_PATH_REQUIRED' in /in/Y3XIE on line 34 Notice: Use of undefined constant FILTER_FLAG_QUERY_REQUIRED - assumed 'FILTER_FLAG_QUERY_REQUIRED' in /in/Y3XIE on line 35 Fatal error: Call to undefined function: filter_var() in /in/Y3XIE on line 39