3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = 'http://#chrütli24/7schwur.ch'; $input = 'www.meinemüllerdomain.ch/index/checkMe?param#whatevs'; $input = 'www.jeng.cc'; $pattern = array(); $pattern[] = '/\xE2\x80\x8B/'; $pattern[] = '/ /'; $pattern[] = '@^[a-z]+://@i'; $pattern[] = '/&#8203;/'; $pattern[] = '/\?/'; $pattern[] = '@^www\.@i'; // if entered, remove whitespaces, prepending protocoll and www. $cleaned = preg_replace($pattern, null, idn_to_utf8(mb_strtolower($input, 'UTF-8'))); //echo $cleaned; // if entered, remove trailing dot $cleaned = (substr($cleaned, -1) == '.') ? substr($cleaned, 0, -1) : $cleaned; //echo $cleaned; if (strpos($cleaned, '@') !== false) { echo 'false'; } $val = filter_var(idn_to_ascii($cleaned), FILTER_VALIDATE_URL); var_dump($val); $correct = filter_var('http://'.$cleaned, FILTER_VALIDATE_URL); var_dump($correct); //var_dump(parse_url($correct)); $testdomain = idn_to_ascii($cleaned); var_dump(filter_var($testdomain, FILTER_VALIDATE_URL));
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: preg_replace(): Passing null to parameter #2 ($replacement) of type array|string is deprecated in /in/LPcLW on line 16 bool(false) string(14) "http://jeng.cc" bool(false)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
59.95 ms | 401 KiB | 8 Q