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


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to