1/* isset() should be used to determine if a variable or element of an array
2is considered set (i.e. if a variable or element of an array is declared
3and is different than null). Returns true if a variable or element of
4an array exists and has any value other than null, false otherwise.
5
6empty() should be used to determine whether a variable or an array
7is considered to be empty. Returns true for a falsey (falsy)[*] (i.e. if
8a variable is zero-length string '' or boolean false or numeric 0 or null
9and if an array has no elements), false otherwise.
10NB! empty() also returns true for non-existing variable since
11such variable is considered falsey (falsy) */
12
13var_dump(empty($nonExistingVariable)); /* true */
14var_dump(isset($nonExistingVariable)); /* false */
15
16$nullVariable = null;
17var_dump(empty($nullVariable)); /* true */
18var_dump(isset($nullVariable)); /* false */
19
20$zeroVariable = 0;
21var_dump(empty($zeroVariable)); /* true */
22var_dump(isset($zeroVariable)); /* true */
23
24$emptyArray = [];
25var_dump(empty($emptyArray)); /* true */
26var_dump(isset($emptyArray)); /* true */
27
28$nonEmptyString = 'Non-empty string';
29var_dump(empty($nonEmptyString)); /* false */
30var_dump(isset($nonEmptyString)); /* true */
31
32/* [*]Falsey (falsy) is anything equivalent to false. I.e., variable or
33array is falsey (falsy) if it casts to boolean as false.
34
35(bool) $someVariable === false
36(bool) $someArray === false */