Q: static method working in PHP4 and PHP5

From: Date: Thu, 24 Mar 2005 13:14:50 +0000
Subject: Q: static method working in PHP4 and PHP5
Groups: php.general 
Request: Send a blank email to php-general+get-211455@lists.php.net to get a copy of this message
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"? 2. Is there a proper way to write such a class that would work properly in both PHP4 and PHP5, without Strict errors? Best regards, -- Piotr Klaban

« previous php.general (#211455) next »