note 77374 deleted from language.oop5 by danbrown
| From: | danbrown@php.net | Date: | Wed, 17 Jun 2009 18:49:40 +0000 |
| Subject: | note 77374 deleted from language.oop5 by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-157017@lists.php.net to get a copy of this message | ||
Note Submitter: bearachute at gmail dot com
----
in addition to mail at touchmypixel dot com:
if methods aren't a concern, a great way to work with anonymous objects is to instantiate
stdClass, which is php's base class. word up on the ECMAScript -- this works great with json!
<?php
$foo = new stdClass();
$foo->bar = 'string';
$foo->num = 10;
header('Content-type: application/json');
echo json_encode($foo);
?>