3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $test = 'aaa.bbb.ccc.ddd.eee.fff.ggg.hhh'; $max = 10; $retry = 1; do { echo $test . "\n"; preg_match("/^.+?\.(.+)$/", $test, $result); if (false === $result) throw new \InvalidArgumentException('invalid'); $test = $result[1]; } while ($retry++ < $max);
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.3.0rc3
aaa.bbb.ccc.ddd.eee.fff.ggg.hhh bbb.ccc.ddd.eee.fff.ggg.hhh ccc.ddd.eee.fff.ggg.hhh ddd.eee.fff.ggg.hhh eee.fff.ggg.hhh fff.ggg.hhh ggg.hhh hhh Notice: Undefined offset: 1 in /in/XiOiI on line 10 Notice: Undefined offset: 1 in /in/XiOiI on line 10 Notice: Undefined offset: 1 in /in/XiOiI on line 10
Output for hhvm-3.15.4
aaa.bbb.ccc.ddd.eee.fff.ggg.hhh bbb.ccc.ddd.eee.fff.ggg.hhh ccc.ddd.eee.fff.ggg.hhh ddd.eee.fff.ggg.hhh eee.fff.ggg.hhh fff.ggg.hhh ggg.hhh hhh Notice: Undefined index: 1 in /in/XiOiI on line 10 Warning: preg_match() expects parameter 2 to be string, null given in /in/XiOiI on line 8 Notice: Undefined index: 1 in /in/XiOiI on line 10 Warning: preg_match() expects parameter 2 to be string, null given in /in/XiOiI on line 8 Notice: Undefined index: 1 in /in/XiOiI on line 10