Hi,

Look at the following example:
---
<?php
class Foo {
  public $bar;
  function __construct() {
    $this->bar->baz = 'blah';
  }
}
$foo = new Foo();
print_r($foo);
?>
--

It results in:
---
Foo Object
(
    [bar] => stdClass Object
        (
            [baz] => blah
        )
)
---

Foo->bar is never declared as anything but "public" and is therefor 
"type-less" (is there a proper term for this?).
As soon as I try to assign Foo->bar->baz, then Foo->bar is cast to an 
stdObject and the baz property is set.

This is pretty much what you would expect, but IMHO this should generate an 
E_NOTICE because you are using a non-object as an object..

Is this just my opinion?

Morten Fangel // fangel

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to