on a manual about overloading i couldn’t grasp one of the threads. The code is below:
<?php
class a
{
function __get($v)
{
$this->$v = new $v;
return $this->$v;
}
}
class b
{
function say($word){
echo $word;
}
}
$a = new a();
$a->b->say('hello world');
// echos 'hello world'
?>
As it has been pointed in the commented line, it echoes hello world. But even though b hasn’t been instantiated how is it being called? Please help, the link to manual is here, entry is belong to user named trash80 at gmail dot com
What it does:
$a->b:$a->b->say('hello world'):