/ Published in: PHP
Returns the contents of a string between two unique strings. Useful for returning the portion of a string found between two tags such as and
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// String to extract string from. $string = 'This is a string to extract <tag>contents between tags</tag> from.'; // Call the function. echo extractString($string, '<tag>', '</tag>'); // Function that returns the string between two strings. function extractString($string, $start, $end) { $string = " ".$string; if ($ini == 0) return ""; } // Value Echoed: contents between tags