开发者

Do PHP functions need to return a value?

Is it necessary to return any value or does it improve the speed? Sometimes its ne开发者_运维百科eded to code functions that not necessary return a value, some just do a set of functions or echo something. Does returning a value improves 'something'?, something like return true or return false?


PHP functions do not need to return anything, and I doubt it would negatively affect the performance if you didn't return anything. If anything, it would positively affect the performance.


but, if you omit the "return something;" command the implicit returned value will be NULL


No, returning a value from a function does not improve the speed of your script.

You do not need to return values from functions -> it is completely optional.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜