Created
February 2, 2021 04:55
-
-
Save cyberdev/e853f7af1a114633e95033d11e4b8c7c to your computer and use it in GitHub Desktop.
Parse Time From Slug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private function parseTimeFromSlug($slug){ | |
$re = '/^(.*)([0-2][0-9])(-)([0-5][0-9])$/m'; | |
$subst = '$2:$4'; | |
$result = preg_replace($re, $subst, $slug); | |
return $result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment