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:
144.08 ms | 1865 KiB | 12 Q