3v4l.org

run code in 300+ PHP versions simultaneously
<?php $main_url_host = 'main.example.com'; $current_url_host = 'subdomain.main.example.com'; preg_match('~(.+)*\.' . $main_url_host. '$~', $current_url_host, $matches ); var_dump( $matches );

preferences:
48.7 ms | 402 KiB | 5 Q