3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = "http://carkva-gazeta.org/римско-католическая-церковь/"; // in case it is https, we don't want to hardcode http $scheme = parse_url($url, PHP_URL_SCHEME); $host = parse_url($url, PHP_URL_HOST); // do not encode the first '/' or the last '/' $encodedPath = strtolowerurlencode(substr(parse_url($url, PHP_URL_PATH), 1, -1))); $encodedUrl = $scheme . "://" . $host . "/" . $encodedPath . "/"; echo $encodedUrl;
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.30
Parse error: syntax error, unexpected ')' in /in/NrFD6 on line 9
Process exited with code 255.

preferences:
184.95 ms | 1395 KiB | 67 Q