3v4l.org

run code in 300+ PHP versions simultaneously
<?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);

preferences:
57.27 ms | 402 KiB | 5 Q