class Foo {
public static function bar() { echo 'bar'; }
}
Foo:bar();
Note the single colon. According to 3v4l http://3v4l.org/Ot3Fk...
5.2.17 and earlier:
Parse error: syntax error, unexpected ':'
5.3 and later, including 7 and HHVM:
Fatal error: Call to undefined function bar()
Is this really a run-time fatal error? Unless I missed a memo, surely this
should be a compile time error.
Foo::bar();
Output for 5.0.0 - 5.6.8, php7@20140507 - 20150501, hhvm-3.6.0 - 3.7.0bar
http://3v4l.org/F6tXZ
2015-05-12 21:44 GMT+03:00 Bishop Bettini bishop@php.net:
class Foo {
public static function bar() { echo 'bar'; }
}
Foo:bar();Note the single colon. According to 3v4l http://3v4l.org/Ot3Fk...
5.2.17 and earlier:
Parse error: syntax error, unexpected ':'5.3 and later, including 7 and HHVM:
Fatal error: Call to undefined function bar()Is this really a run-time fatal error? Unless I missed a memo, surely this
should be a compile time error.
Bishop Bettini wrote:
class Foo {
public static function bar() { echo 'bar'; }
}
Foo:bar();Note the single colon. According to 3v4l http://3v4l.org/Ot3Fk...
5.2.17 and earlier:
Parse error: syntax error, unexpected ':'5.3 and later, including 7 and HHVM:
Fatal error: Call to undefined function bar()Is this really a run-time fatal error? Unless I missed a memo, surely this
should be a compile time error.
Foo:bar();
is the same as
Foo:
bar();
so it is parsed as labelled statement, and as such is syntactically
valid since PHP 5.3.
--
Christoph M. Becker
Bishop Bettini wrote:
class Foo {
public static function bar() { echo 'bar'; }
}
Foo:bar();Note the single colon. According to 3v4l http://3v4l.org/Ot3Fk...
Foo:bar();
is the same as
Foo:
bar();so it is parsed as labelled statement, and as such is syntactically
valid since PHP 5.3.
Ah, labels, right. Thanks!
I will now go off and grumble that labels should mandate, rather than just
accept, block scope since it's easy to forget one half of Paamayim
Nekudotayim....
Hi,
5.3 and later, including 7 and HHVM:
Fatal error: Call to undefined function bar()
5.3 introduced goto and labels.
foo:bar();
is equal to
foo:
bar();
meaning a label foo and then a function call.
johannes