3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = 'https://example.com/pathurl'; $bits = parse_url($url); $sub = strtok($bits['host'], '.'); echo $sub . PHP_EOL; $url = 'https://subdomain.example.com/pathurl'; $bits = parse_url($url); $sub = strtok($bits['host'], '.'); echo $sub . PHP_EOL;

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
154.08 ms | 1866 KiB | 10 Q