PHP 5.3命名空间应该使用反斜杠的每个PHP函数吗? [英] PHP 5.3 Namespaces should i use every PHP function with backslash?

查看:158
本文介绍了PHP 5.3命名空间应该使用反斜杠的每个PHP函数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



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

解决方案

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

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.

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?

解决方案

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.

这篇关于PHP 5.3命名空间应该使用反斜杠的每个PHP函数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆