/**
* get_text()
*
* $t The total text string
* $s starting text string [e.g. <h1>]
* $e ending text string [e.g. </h1>
*
* @return the extracted text string. [e.g., returns string between start and end texts.
*/
function get_text($text, $s, $e) // Get string out of text
{
$sp = strpos($text, $s, 0) + strlen($s);
$ep = strpos($text, $e, 0);
return substr($text, $sp, $ep - $sp);
}
Matt Palermo wrote:
Hello. I was wondering if anyone knew of a function to get the value between 2 strings. For example, lets say I have the following line:
$line = "I want the value between word ONE and word TWO. Please return it...";
Now, I want to get everything between "ONE" and "TWO". In this example it should return the value " and word ". Is there some sort of function I could use to easily do this? Please let me know if you have any ideas.
Thanks,
Matt
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php