3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $urls = array( "http://backend_dev.ms.ji-dev1.bgcc.at/", "asdf.bc", "http://google.at", "www.google.at", "https://service.justimmo.at/objekt" ); foreach ($urls as $url) { echo "\n"; if (filter_var($url, FILTER_VALIDATE_URL) === false) { echo("$url ########################### INVALID"); } else { echo("$url -- VALID"); } echo "\n"; var_dump(is_url($url)); } function is_url($uri){ if(preg_match( '/^(http|https):\\/\\/[a-z0-9_]+([\\-\\.]{1}[a-z_0-9]+)*\\.[_a-z]{2,5}'.'((:[0-9]{1,5})?\\/.*)?$/i' ,$uri)){ return $uri . " -- VALID"; } else{ return false; } }
based on fQZ7q
Output for 5.6.0 - 7.0.2, 7.0.4 - 7.3.0beta1
http://backend_dev.ms.ji-dev1.bgcc.at/ ########################### INVALID string(47) "http://backend_dev.ms.ji-dev1.bgcc.at/ -- VALID" asdf.bc ########################### INVALID bool(false) http://google.at -- VALID string(25) "http://google.at -- VALID" www.google.at ########################### INVALID bool(false) https://service.justimmo.at/objekt -- VALID string(43) "https://service.justimmo.at/objekt -- VALID"
Output for 7.0.3

Process exited with code 137.