How to get first and last occurence of an array of words in text using PHP?

Posted by Runner on Stack Overflow See other posts from Stack Overflow or by Runner
Published on 2010-04-12T09:32:35Z Indexed on 2010/04/12 9:43 UTC
Read the original article Hit count: 171

Filed under:
|
$arr = array('superman','gossipgirl',...);


$text = 'arbitary stuff here...';

What I want to do is find the first/last occurencing index of each word in $arr within $text,how to do it efficiently in PHP?

© Stack Overflow or respective owner

Related posts about php

Related posts about string-manipulation