/ Published in: PHP

Get the substring between two strings
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * Returns the substring between two strings, delimiters not included * @param string $string Haystack * @param string $start Starting delimiter * @param string|null $end Ending delimiter, if omitted will return the rest of the string * @return bool|string The substring between $start and $end or false if either string is not found */ function substr_between($string, $start, $end=null) { if($end) { } } else { } } return false; }
Comments
