Created
August 4, 2018 16:20
-
-
Save vicgonvt/994dfcc31cad0c490e3e91c8bc471e20 to your computer and use it in GitHub Desktop.
Revisions
-
vicgonvt revised this gist
Aug 4, 2018 . 1 changed file with 2 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,3 +1,5 @@ <?php function str_between($string, $start, $end, $innerOnly = true, $remove = false) { if (($startPosition = strpos($string, $start)) === false || ($endPosition = strpos($string, $end)) === false) { -
vicgonvt created this gist
Aug 4, 2018 .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,19 @@ function str_between($string, $start, $end, $innerOnly = true, $remove = false) { if (($startPosition = strpos($string, $start)) === false || ($endPosition = strpos($string, $end)) === false) { return false; } if ($innerOnly) { $startPosition += strlen($start); $endPosition -= strlen($end); } $between = substr($string, $startPosition, ($endPosition + strlen($end)) - $startPosition); if ($remove) { return str_replace($between, '', $string); } return $between; }