Guest Posted February 25, 2007 Share Posted February 25, 2007 I have a big array of words and i want to strip all the words out of it that do not appear more than $amount Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 25, 2007 Share Posted February 25, 2007 Can you explain your problem better and give a short example? Ken Quote Link to comment Share on other sites More sharing options...
Guest Posted February 25, 2007 Share Posted February 25, 2007 There are a bunch of words in a array I would want to take all the words out that occur less than so many times. like $amount = 2 array name user idontknow whatever name I would want to strip everything except for name because it occurs the amount of amount or more Quote Link to comment Share on other sites More sharing options...
Guest Posted February 25, 2007 Share Posted February 25, 2007 Does anyone know how I can do this? Quote Link to comment Share on other sites More sharing options...
Orio Posted February 25, 2007 Share Posted February 25, 2007 Try this function: <?php function filter_array($array, $amount) { $copy = $array; foreach($array as $key => $val) if(count(array_keys($array, $array[$key])) < $amount) unset($copy[$key]); return $copy; } ?> Orio. Quote Link to comment Share on other sites More sharing options...
Guest Posted February 25, 2007 Share Posted February 25, 2007 Thank You Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.