diff options
Diffstat (limited to 'oo/blank_object.php')
-rw-r--r-- | oo/blank_object.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/oo/blank_object.php b/oo/blank_object.php index 25803d0..751402e 100644 --- a/oo/blank_object.php +++ b/oo/blank_object.php @@ -5,6 +5,11 @@ * When you cast a scalar or array as Object, you get an instance of stdClass. Bare bones data structure for key-val entries */ +$obj_w_scalar = (object) 'bar'; +print $obj_w_scalar->scalar . PHP_EOL; +foreach ($obj_w_scalar as $key => $val) + print "'$key' <--> '$val'" . PHP_EOL; + $obj = new StdClass(); $obj->foo = 'bar'; |