3v4l.org

run code in 300+ PHP versions simultaneously
<?php preg_match('/^[^.]*\.(?=\w+\.\w+$)/','subdomain.example.com',$matches); $subdomain = isset($matches[0]) ? trim($matches[0],'.') : ''; echo $subdomain;

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
162.39 ms | 1863 KiB | 12 Q