match items in an array against text |
[eluser]matt2012[/eluser]
Ok so I have a large array and a large text to search my aim to create a new array based on what items in the large array are found in the text so something like Code: $myarray = array("apple juice","nice cake","ice cream",...) given that its a large array and large text this seems inefficient is their a better way to tackle this?
[eluser]GSV Sleeper Service[/eluser]
you may be better off using preg_match_all() http://uk3.php.net/manual/en/function.pr...ch-all.php I expect there's an even neater solution, but I'm not really in the mood for trawling through the php docs!
[eluser]davidbehler[/eluser]
As far as I can tell there is no build-in function that does what you need. On the strpos - Manual you can find a custom function similar to yours: Code: function strposa($haystack ,$needles=array(),$offset=0){ |
Welcome Guest, Not a member yet? Register Sign In |