gryphius Posted December 22, 2006 Share Posted December 22, 2006 I'm running PHP 5.2 on Windows. My "problem" is best described with these two examples:This one works as excected and prints 'Hello'.[code]SomeClass::sayHello();class SomeClass { public static function sayHello() { echo 'Hello'; }}[/code]The following one however results in "[b]Fatal error: Class 'SomeClass' not found[/b]". The only noteworthy change is the '[b]implements SomeInterface[/b]'.[code]SomeClass::sayHello();interface SomeInterface {}class SomeClass implements SomeInterface { public static function sayHello() { echo 'Hello'; }}[/code]The error can be solved by moving the line [b]SomeClass::sayHello();[/b] below the class definition.My question: Does this behaviour make sense in any way that I don't get or is this a bug? It's nothing dramatic but still annoying. Link to comment https://forums.phpfreaks.com/topic/31604-strange-behaviour-when-combining-interfaces-and-static-methods/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.