PHPEdit.net Community
   
1 2 3 4
Tutorials Tips Pasties Code Snippets
 

Home > Code snippets > PHP > Arrays > array_filter

array_filter

Created by LetsSurf, last update on 26/02/2008 10:12

Will filter out certain element of the array you don't want 

  1. function array_filter($array, $filter) {
  2. foreach ($filter as $filterKey) {
  3. if (array_key_exists($filterKey, $array)) {
  4. unset($array[$filterKey]);
  5. }
  6. }
  7. return $array;
  8. }

Dependencies

No special requirements are needed by this snippet

By logging in you will be able to:

  • Recommand this page to someone else
  • Monitor changes on this item
  • Rate this item
  • Post comments
  • Download this item
Login now!

 
PHPEdit User Community, © 2008 WaterProof SARL
Powered by PHPEdit