The difference between return '' and return in PHP
为情所困
为情所困 2017-05-31 10:34:30
0
2
765

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?

为情所困
为情所困

reply all(2)
世界只因有你
  • 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 false

迷茫

I 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 (~—~))

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template