Press "Enter" to skip to content

No need to return null

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.

 

One Comment

  1. Humberto Mollicone
    Humberto Mollicone September 22, 2018

    I do like the way you have framed this specific challenge and it does provide us some fodder for thought. Nevertheless, coming from what precisely I have seen, I simply hope when other feed-back pile on that people today remain on issue and in no way embark upon a soap box associated with some other news of the day. Anyway, thank you for this fantastic piece and whilst I can not necessarily go along with it in totality, I value the perspective.

Leave a Reply

Your email address will not be published.