PHP:func_get_args 性能? [英] PHP: func_get_args performance?

查看:53
本文介绍了PHP:func_get_args 性能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将使用 func_get_args 来读取函数调用的附加参数.

I'm about to use func_get_args for reading additional arguments of a function call.

这对性能有何影响?我应该使用数组来传递额外的参数,而不是使用上面的函数读取它们吗?

How does this affect the performance? Should I rather use an array for passing additional arguments instead of reading them with the function above?

推荐答案

除非您大量使用它,否则任何单个功能都不会产生如此大的差异.你总是可以在调用前后使用 microtime() 来检查调用需要多长时间,但我认为你不会发现任何有趣的东西.

Unless you are using it in mass quantities, no single function will make that much difference. You could always check how long it takes to call by using microtime() before and after the call, but I don't think you'll find anything interesting.

如果您愿意,请继续使用它.

Go ahead and use it if you'd like.

我会更担心确保其他程序员了解该函数的工作原理并知道他们可以将任意数量的参数传递给该函数.

I'd be more worried about making sure other programmers understand how the function works and knowing that they can pass any number of arguments to the function.

这篇关于PHP:func_get_args 性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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