title: foreach - looping through object and changing values - php5
body: <p>I have a simple wee cleansing function in PHP</p>
  
  <p>It takes a value or array of values and does some input cleansing. Now I'm using mysqli which is fetching rows as objects so I need to be able to apply it to obejcts as well as arrays</p>
  
  <pre><code>function filter_out($output=''){
      if($output != ''){
          // i.e passed $_POST array
          if(is_array($output)){
              $newoutput = array();
              foreach($output as $outputname=&gt;$outputval){
                  $newoutput[$outputname] = stripslashes($outputval);
                  $newoutput[$outputname] = htmlspecialchars($newoutput[$outputname]); 
              }
          } else if(is_object($input)){
              ?
          }
      }
  }
  </code></pre>
  
  <p>Can anyone tell me how I can do the equivalent with object as input?</p>