title: Filter Items from JSON Objects in PHP
body: <p>I have this Function/Method for filtering out a Blacklist of words in an <code>ARRAY()</code> using <code>array_filter</code> but I need to do something similar to my Objects in this code below...</p>
  
  <p>JSON Objects</p>
  
  <pre><code>// Get JSON Object
  $obj = json_decode($out);
  
  // Iterate JSON Object
  foreach($obj as $index =&gt; $user) {
      echo $user-&gt;id;
      echo $user-&gt;screen_name;
      echo $user-&gt;language;
      echo $user-&gt;location;
      echo $user-&gt;time_zone;
      echo $last_status_date;
      echo $user-&gt;status-&gt;text;
  
  
      // Filter out Objects that match the Blacklist
  
  
      // insert remainning into database here
  
  }
  </code></pre>
  
  <p>My current Blacklist Filter Function  </p>
  
  <pre><code>public function blacklistFilter($raw_array){
  
      //$data1 = array('Phillyfreelance' , 'PhillyWebJobs', 'web2project', 'cleanname');
      $data1 = array_filter($data1, function($el) {
              $bad_words = array('job', 'freelance', 'project', 'gig', 'word', 'news', 'studio');
              $word_okay = true;
  
              foreach ( $bad_words as $bad_word ) {
                  if ( stripos($el, $bad_word) !== FALSE ) {
                      $word_okay = false;
                      break;
                  }
              }
  
              return $word_okay;
      });
  }
  </code></pre>
  
  <hr>
  
  <p>So I am curious if there is a simialr function for filtering objects as <code>array_filter</code> does for ARRAYS?</p>
  
  <p>Ultimately my goal is to be able to pass hundreds of JSON Objects through a function and be able to filter out ones that match a set of words in the username, filter out ones that match a language, and filter ones out that match a location or time zone</p>