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 on Facebook and Twitter

Sorry, comments disabled and hidden due to excessive spam.

Meanwhile, hit me up on twitter @stoyanstefanov