Skip to content

Instantly share code, notes, and snippets.

@cyberdev
Created February 2, 2021 04:55
Show Gist options
  • Save cyberdev/e853f7af1a114633e95033d11e4b8c7c to your computer and use it in GitHub Desktop.
Save cyberdev/e853f7af1a114633e95033d11e4b8c7c to your computer and use it in GitHub Desktop.
Parse Time From Slug
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