3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $timePeriods = array( 'weekly' => 1, 'fortnightly' => 2, 'fourweekly' => 4, 'bianually' => 26, 'anually' => 52 ); $periods = array_keys($timePeriods); $recordName = 'ni_fortweekly_earning_limit'; $regex = '(' . implode('|', $periods) . ')'; $a = preg_match($regex, $recordName); var_dump($regex);
based on kJmkp
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
string(49) "(weekly|fortnightly|fourweekly|bianually|anually)"
Output for hhvm-3.10.0

Process exited with code 137.