- var_dump: documentation ( source)
- preg_match: documentation ( source)
- implode: documentation ( source)
- array_keys: documentation ( source)
<?php
$timePeriods = array(
'weekly' => 1,
'fortnightly' => 2,
'fourweekly' => 4,
'bianually' => 26,
'anually' => 52
);
$pregResult = array();
$periods = array_keys($timePeriods);
$recordName = 'ni_fortweekly_earning_limit';
$regex = '(' . implode('|', $periods) . ')';
$a = preg_match($regex, $recordName, $pregResult);
var_dump($pregResult);