3v4l.org

run code in 500+ PHP versions simultaneously
<?php $urls = [ 'https://danielabruña.com/', 'https://fagualópez.com/', 'https://laconspiracióndelcastellano.com/', ]; foreach ($urls as $url) { $raw_domain = parse_url($url, PHP_URL_HOST); $encoded_domain = idn_to_ascii($raw_domain); $new_url = substr_replace($url, $encoded_domain, stripos($url, $raw_domain), strlen($raw_domain)); var_dump($url, $new_url); }
Output for 8.5.1 - 8.5.3
Fatal error: Uncaught Error: Call to undefined function idn_to_ascii() in /in/nRle4:11 Stack trace: #0 {main} thrown in /in/nRle4 on line 11
Process exited with code 255.
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0
string(26) "https://danielabruña.com/" string(32) "https://xn--danielabrua-beb.com/" string(24) "https://fagualópez.com/" string(30) "https://xn--fagualpez-b7a.com/" string(41) "https://laconspiracióndelcastellano.com/" string(47) "https://xn--laconspiracindelcastellano-ctc.com/"

preferences:
80.2 ms | 1293 KiB | 4 Q