<?php $strs = ['Time 24hours','Time 36hour','Time 72hr','Time 96h','Time 24hrs','Time 35h']; $rx = '~\b(?:(24|36|48|72|96)|(\d+))(h(?:(?:ou)?rs?)?)\b~'; foreach ($strs as $s) { echo preg_replace_callback($rx, function($m) { return !empty($m[1]) ? $m[1] . 'HR' : $m[2] . 'ET'; }, $s) . PHP_EOL; }
You have javascript disabled. You will not be able to edit any code.