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 Link to comment https://forums.phpfreaks.com/topic/40005-solved-array-multiple/ 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 Link to comment https://forums.phpfreaks.com/topic/40005-solved-array-multiple/#findComment-193474 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 Link to comment https://forums.phpfreaks.com/topic/40005-solved-array-multiple/#findComment-193486 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? Link to comment https://forums.phpfreaks.com/topic/40005-solved-array-multiple/#findComment-193732 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. Link to comment https://forums.phpfreaks.com/topic/40005-solved-array-multiple/#findComment-193741 Share on other sites More sharing options...
Guest Posted February 25, 2007 Share Posted February 25, 2007 Thank You Link to comment https://forums.phpfreaks.com/topic/40005-solved-array-multiple/#findComment-193810 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.