Skip to content

Instantly share code, notes, and snippets.

@jibe0123
Created May 23, 2018 15:28
Show Gist options
  • Save jibe0123/bdeebb58be7ac0303af792fafbce71a1 to your computer and use it in GitHub Desktop.
Save jibe0123/bdeebb58be7ac0303af792fafbce71a1 to your computer and use it in GitHub Desktop.
get_string_between
function get_string_between($string, $start, $end){
$string = ' ' . $string;
$ini = strpos($string, $start);
if ($ini == 0) return '';
$ini += strlen($start);
$len = strpos($string, $end, $ini) - $ini;
return substr($string, $ini, $len);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment