Press "Enter" to skip to content

No need to return null

Sharing is caring!

There is no need to return null within the function. It there is no return specified at the end of the function, null is assumed to be returned;

i.e. No return value in PHP is identical to NULL

In the documentation it says,

If the return is omitted the value NULL will be returned.

But it is always a better idea to return some Boolean values to indicate that the function worked as it was supposed to.

Everything is awesome.


Be First to Comment

    Leave a Reply

    Your email address will not be published.