In php, should I return false, null, or an empty array in a method that would usually return an array?

后端 未结 8 712
面向向阳花
面向向阳花 2021-02-01 18:22

I\'ve found several responses to this, but none pertaining to PHP (which is an extremely weak typed language):

With regards to PHP, is it appropriate to return

8条回答
  •  無奈伤痛
    2021-02-01 19:14

    If there's really a problem then you should raise an error, otherwise if the criteria aren't met etc then return a blank array.

提交回复
热议问题