Please, what does "(!$var)" mean?

I think it might mean "is $var null".

Also, what's the PHP reference?

Thanks.

Recommended Answers

All 3 Replies

It's using the Logical NOT operator '!' to test if the variable '$var' is False, eg...

if (!$var){
    echo "False";
}

If you asking about the php reference manual , you will get it at php.net
or else if its the reference variable you looking out for, which stores the address of some other variable and using it we can directly manipulate on the value of that variable getting referenced.
Like when you pass the variable as reference like below -
function_name(&$var);
the function_name can directly change the value of the variable it refers to.
and as you have noted its been denoted with the letter '&'

(!$var)

To extend on what @Calver said, it tests whether a variable is false.

The following variables will evaluated as "false":

1. NULL
2. Empty string
3. Boolean false
4. 0 (zero)
5. Non-existant variables

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.