×

Welcome to TagMyCode

Please login or create account to add a snippet.
3
0
 
0
Language: PHP
Posted by: Nick Ionita
Added: Mar 30, 2014 3:27 PM
Views: 30
Tags: php
For real quick and dirty one-liner anonymous objects, just cast an associative array
  1. $obj = (object) array('foo' => 'bar', 'property' => 'value');
  2.  
  3. echo $obj->foo; // prints 'bar'
  4. echo $obj->property; // prints 'value'
  5.