Simple question, what's $this - a or b?
<?php
class a {
function aa(){
var_dump($this);
}
}
class b {
function bb(){
a::aa();
}
}
$b_obj = new b;
$b_obj->bb();
?>
Answer: object(b)#1 (0) { }
This entry was posted
on Thursday, August 31st, 2006 and is filed under PHP certification.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
February 20th, 2007 at 7:02 am
Althoug code is very small, but thats sufficient to explain the meaning of $this. I loved it.
Thanks for a brainy posting.
October 18th, 2007 at 3:35 am
the answer is a , because $this that mean this is to this class