Advertisement
Guest User

Remove

a guest
Mar 4th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.29 KB | None | 0 0
  1. <?php
  2.  
  3. $array = array(
  4.    'test'    => 'lol',
  5.    'removed' => 'this one will be gone'
  6. );
  7.  
  8. // Casting the array to a object
  9. $object = (object)$array;
  10.  
  11. // Prints the object without the removed content
  12. print_r($object);
  13.  
  14. function remove($object) {
  15.     unset($object->removed);
  16. }
  17.  
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement