3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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 );
Output for hhvm-3.15.4 - 3.22.0, 7.0.0 - 7.3.0beta2
array(2) { [0]=> string(26) "subdomain.main.example.com" [1]=> string(9) "subdomain" }
Output for 5.6.30
array(0) { }