static call of non-static method?

static call of non-static method?

am 21.09.2007 14:49:38 von Mads Lee Jensen

Hi i was wondering why i can call a class method, by double colon.
without declaring it static.

this is my test

class Test_1
{
public function hello()
{
echo 'Hello';
}
}
Test_1::hello();

Re: static call of non-static method?

am 21.09.2007 15:04:18 von gosha bine

On 21.09.2007 14:49 Mads Lee Jensen wrote:
> Hi i was wondering why i can call a class method, by double colon.
> without declaring it static.
>
> this is my test
>
> class Test_1
> {
> public function hello()
> {
> echo 'Hello';
> }
> }
> Test_1::hello();
>

This behaviour is for compatibility with php4. It raises a E_STRICT
error in php5 and will be fatal error in php6.


--
gosha bine

makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi