What’s $this?

August 31st, 2006. Tagged: PHP certification

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) { }

Tell your friends about this post: Facebook, Twitter, Google+

Sorry, comments disabled and hidden due to excessive spam. Working on restoring the existing comments...

Meanwhile, hit me up on twitter @stoyanstefanov