Last active
March 4, 2019 10:19
-
-
Save hedii/320c5aa45e11ddd765e7 to your computer and use it in GitHub Desktop.
Revisions
-
hedii revised this gist
Apr 11, 2015 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,13 @@ <?php /** * get_string_between function. * * Given a string ($string) and two delimiters ($start and $end), this function * returns the substring between $start and $end. $start and $end are also * removed. * * @link http://www.justin-cook.com/wp/2006/03/31/php-parse-a-string-between-two-strings/ * * @access public * @param string $string @@ -18,6 +21,7 @@ function get_string_between($string, $start, $end){ $ini = strpos($string, $start); if ($ini == 0) { return ''; } $ini += strlen($start); $len = strpos($string, $end, $ini) - $ini; -
hedii created this gist
Apr 11, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ <?php /** * get_string_between function. * * Given a string ($string) and two delimiters ($start and $end), this function * returns the substring between $start and $end. $start and $end are also * removed. * * @access public * @param string $string * @param string $start * @param string $end * @return string the string between $start and $end */ 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); }