3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $main_url_host = 'main.example.com'; $current_url_host = 'sub.main.example.com'; preg_match('~(.+)*\.' . $main_url_host. '~', $current_url_host, $matches ); var_dump($matches[1]);
Output for hhvm-3.15.4 - 3.22.0, 7.0.0 - 7.3.0rc3
string(3) "sub"
Output for 5.6.30
Notice: Undefined offset: 1 in /in/dCbpP on line 7 NULL