I'm trying to grab a string from within a string based on a matching word or
phrase. Example...

$string = "This is a string I need to grab the middle out of"
$query_word = "need"

I need to get x amount of characters either side of $query_word, so the
result string would be like...

"string I need to grab the"

And I need the result string to be full words, not like..."ing I need to
grab th"

I've half managed to do it using strpos and substr but the code is really
messy and I'm getting half-formed words back. Anyone got any suggestion on
how to accomplish this?

Thanks very much in advance.

Steve


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to