开发者

Do PHP functions need to return a value?

开发者 https://www.devze.com 2023-04-10 13:10 出处:网络
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 somet

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

精彩评论

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

关注公众号