Re: Q: static method working in PHP4 and PHP5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Piotr Klaban wrote:
Hi,

An example script:

<?php
error_reporting(4095);
class Foo {
function test() {
}
}
Foo::test(); ?>


would produce in PHP5 error:
PHP Strict Standards:  Non-static method Foo::test() should not be called statically in ... line 8

I have two questions:

1. Could it be possible that under specific circumstances such a call
   can produce fatal error "Non-static method Foo::test() cannot be called statically"?

no
2. Is there a proper way to write such a class that would work properly in both
   PHP4 and PHP5, without Strict errors?
no, unless you keep this code and turn off E_STRICT error_reporting

Best regards,


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux