I tried it, and the results returned by var_dump were all NUll. Baidu also found no clear answer.
I saw that return '' seems to be used more often in the code written by others. Could you please tell me about return '' and return in PHP. What's the difference?
return '' returns an empty string
return returns null
You can see it through the var_dump result.
For PHP's weakly typed language, there is actually no difference if you don't use it carefully.
But using
===
, the comparison will show falseI think generally don’t return null, return an empty string or empty array, so that the data acquisition party can process it uniformly (less judgment (~—~))