PHP 5.3命名空间我应该使用反斜杠的每个PHP函数吗?

时间:2022-09-10 23:10:20

im now using namespaces in PHP 5.3 now there is a fallback mechanism for functions which dont exist in the namespace. so php every time checks if the function exists in namespace and then tries to load it from global space.

我现在在PHP 5.3中使用命名空间,现在有一个函数的回退机制,它不存在于命名空间中。所以php每次检查函数是否存在于命名空间中,然后尝试从全局空间加载它。

So what about all php internal functions? strstr for example? Should i now use every php internal function with a \ ? to avoid php first checking the namespace? is this fallback a huge performance drop? what do you think?

那么所有php内部函数呢?例如strstr?我现在应该使用每个php内部函数吗?避免php首先检查命名空间?这个后备是一个巨大的性能下降?你怎么看?

1 个解决方案

#1


18  

No matter the performance hit, no way should you do that. Ew, ew, ew. Any performance boost there may be is not worth your sanity.

无论性能如何,你都不应该这样做。 Ew,ew,ew。任何性能提升可能都不值得你的理智。

#1


18  

No matter the performance hit, no way should you do that. Ew, ew, ew. Any performance boost there may be is not worth your sanity.

无论性能如何,你都不应该这样做。 Ew,ew,ew。任何性能提升可能都不值得你的理智。