Skip to content

Instantly share code, notes, and snippets.

@piccaso
Last active December 13, 2015 23:29
Show Gist options
  • Save piccaso/4991824 to your computer and use it in GitHub Desktop.
Save piccaso/4991824 to your computer and use it in GitHub Desktop.
<?php
function preg_extract($pattern,$subject,$n=1,$default=''){
if(preg_match($pattern, $subject, $m)){
if (isset($m[$n])) return $m[$n];
}
return $default;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment