Sorry vary basic question When a variable is declared? just want to clarify that

WHen a variable in php is declared it means that it is equal to 1 or any string value right?

When it is not declare it’s because it is equal to 0, empty, null or false right?

No, not really.
A variable can have any value - including type null.

An undefined variable doesn’t really have a value, because it’s not defined. But if you try to read the value of an undefined variable, php will be nice to you and make a value up. This value is always type null.

Which values are “equal” to other values depends on which equality comparison operator you use(== vs ===) and what type of operands(the values on the left and right of the operator), and what value they have.

It’s kinda hairy.

But, if you just want to know if “a variable exists”, isset() should do the trick. It does nothing more than check if the value of a variable is type null. So, you can’t use this to distinguish between an undefined variable, and a variable that has been assigned the value of type null. But, it’s very uncommon to need to make such a distinction. Different way’s do exist if you need to.

Wow, I never knew isset() returned false for null. I feel like I just discovered food… I guess we all learn something every day.