override static function


<?php

class a

{

    public static function aa()

    {

        echo 1;

    }


    public static function c()

    {

        self::aa();

    }

}


class b extends a

{

    public static function aa()

    {

        echo 2;

    }

}


b::c();

?>

above code execute, print 1

but, i think it should be print 2, isn’t it? it’s bug?

if override b::c(), it will be print 2

php5.2.11 + Windows XP

The answer is that .

No, the above output is correct. Unfortunately it makes it kinda hard to extend the Yii helpers.

What you think about “Yii::app()->helpers->html”? Why isn’t it implemented in this way? Only because it’s more writing or are there any other reasons? :mellow:

See this:

http://www.yiiframework.com/forum/index.php?/topic/660-new-way-of-using-helpers/page__p__3518__fromsearch__1&#entry3518