In php, namespaces a forward slash?
Why do namespaces, in PHP, use a backslash () to seperate folders?
Eg:
namespace CorefruitApple;
Are there any particular reasons for this?
I feel the backslash convention is illogical because unix/linux file systems utilize forward slashes. But my opinion is beside the point.
Here's why PHP decided to use backslash for namespaces: https://wiki.php.net/rfc/namespaceseparator
Criterions
(1) type-ability (how easy is it to type the separator)
(2) typo-vulnerability (how easy is it to make a typo and get an unwanted behavior without a error/warning)
(3) parse-ability (how easy is it to read the code and figure out whats going on without getting confused with similar syntax that means another thing)
(4) IDE compatibility (5) number of chars
An article expressing an interesting opinion is a good read also: http://www.newmediacampaigns.com/page/php-namespaces-backslash-example
链接地址: http://www.djcxy.com/p/58138.html上一篇: PHP单元Selenium Webdriver:如何通过按键与sendKeys()发送密钥
下一篇: 在PHP中,命名空间是正斜杠?