empty values
Posted: Thu Oct 28, 2010 7:28 am
Hello,
What are the output of these statements:
$var = 0
echo ( $var != "")
I would say it outputs true but it actually output false which means $var is "". But it is not, its integer 0
So, is "" same as integer 0 if not comparing by type using !==
Are these all empty values when comparing using $var != "":
$var = 0
$var = "0"
$var = array()
$var = ""
$var = null
$var false
What are the output of these statements:
$var = 0
echo ( $var != "")
I would say it outputs true but it actually output false which means $var is "". But it is not, its integer 0
So, is "" same as integer 0 if not comparing by type using !==
Are these all empty values when comparing using $var != "":
$var = 0
$var = "0"
$var = array()
$var = ""
$var = null
$var false