Why are dynamic class methods specified with the double colon notation?
This is puzzling me: http://php.net/manual/en/开发者_开发问答dateinterval.format.php
public string DateInterval::format ( string $format )
The method is not static, yet it is given the double colons. What's the reasoning here?
That's nothing more than PHP authors'/developers' way of writing a method name qualified by its class. It isn't related to the static/dynamic nature of a method.
You'll spot this notation in PHP's errors as well. For example,
$o = new stdClass;
$o->method();
produces this error:
Fatal error: Call to undefined method stdClass::method()
精彩评论