- $res = null;
-
- // Algorithm: use regular expressions to find a matching pattern, starting with most popular patterns first.
- $tmp_val = trim($value);
-
- // 24 hour patterns.
- if (preg_match('/^([01][0-9]|2[0-3]):[0-5][0-9]$/', $tmp_val)) { // 00:00 - 23:59
- // We already have a 24-hour format. Just return it.
- $res = $tmp_val;
- return $res;
- }
- if (preg_match('/^[0-9]:[0-5][0-9]$/', $tmp_val)) { // 0:00 - 9:59
- // This is a 24-hour format without a leading zero. Add 0 and return.
- $res = '0'.$tmp_val;
- return $res;
- }
+ $res = null;
+
+ // Algorithm: use regular expressions to find a matching pattern, starting with most popular patterns first.
+ $tmp_val = trim($value);
+
+ // 24 hour patterns.
+ if (preg_match('/^([01][0-9]|2[0-3]):[0-5][0-9]$/', $tmp_val)) { // 00:00 - 23:59
+ // We already have a 24-hour format. Just return it.
+ $res = $tmp_val;
+ return $res;
+ }
+ if (preg_match('/^[0-9]:[0-5][0-9]$/', $tmp_val)) { // 0:00 - 9:59
+ // This is a 24-hour format without a leading zero. Add 0 and return.
+ $res = '0'.$tmp_val;
+ return $res;
+ }