In PHP, what is the differences between NULL and setting a string to equal 2 single quotes

后端 未结 5 1339
情歌与酒
情歌与酒 2020-11-30 05:06

I used to set things like this when I wanted blank values.

$blankVar = \'\';

Then after some months, I decided this looked better and had a

5条回答
  •  北荒
    北荒 (楼主)
    2020-11-30 05:20

    null is a special placeholder value in the programming language that literally means "nothing". It's not 0, it's not an empty string, it's nothing. There is no value in memory being pointed to. An empty string, on the other hand, is still a string object, just a very short one :)

提交回复
热议问题