Lines Matching refs:empty
2 Test unset(), empty() and isset() functions
5 echo "*** Testing unset(), empty() & isset() with scalar variables ***\n";
47 // checking if the var is empty, expected: bool(false) on most
49 var_dump( empty($scalar_var) );
60 // empty to check if empty, expecting bool(true)
61 var_dump( empty($scalar_var) );
71 echo "\n*** Testing unset(), empty() & isset() with arrays ***\n";
82 array(1,2, "One" => "1", 2 => "two", ""=>"empty", "" => '')
93 // check using isset() & empty() on a non_existent element in the array
97 var_dump( empty($array_var['non_existent']) );
99 // testing empty and isset on arrays
100 …var_dump( empty($array_var) ); // expecting bool(false), except: array(), which is considered empty
105 // unset each element in the array and see the working of unset, isset & empty
120 // calling empty, expected bool(true)
121 var_dump( empty($array_var[$key_val]) );
124 // because of using isset, empty and unset on its element
138 // empty() to see if the array is empty
139 var_dump( empty($array_var) ); // expected: bool(true)
142 echo "\n*** Testing unset(), empty() & isset() with resource variables ***\n";
156 // check using isset() and empty()
158 var_dump( empty($resource) ); // expected: bool(false)
162 // dump the resource to see using isset() and empty () had no effect on it
167 // check using isset() and empty()
169 var_dump( empty($resource) ); // expected: bool(true)
185 var_dump( empty($resources) ); // expected: bool(true)
187 echo "\n*** Testing unset(), empty() & isset() with objects ***\n";
208 // use unset/empty/isset to check the object
213 var_dump( empty($point1) ); // expected: bool(false)
215 var_dump( empty($point1->$lable) ); //expected: bool(true)
220 var_dump( empty($point1->$lable) ); //expected: bool(false)
223 // because of the usage of the isset & empty
231 var_dump( empty($point1->x) ); // expected: bool(true)
239 var_dump( empty($point1) ); // expected: bool(false)
244 var_dump( empty($point1) ); // expected: bool(true)
248 // try isset/unset/empty on a member function
251 var_dump( empty($point2->testPoint) );
254 var_dump( empty($point2->testPoint) );
261 /* testing variation in operation for isset(), empty() & unset().
266 echo "\n*** Testing possible variation in operation for isset(), empty() & unset() ***\n";
279 // check using isset and empty
281 var_dump( empty($static_var) );
286 // check using isset and empty
288 var_dump( empty($static_var) );
309 // check using isset and empty to confirm
311 var_dump( empty($ref_val) );
334 // check the $global_var using isset and empty
336 var_dump( empty($global_var) );
341 // check the $global_var using isset and empty
343 var_dump( empty($global_var) );
354 *** Testing unset(), empty() & isset() with scalar variables ***
680 *** Testing unset(), empty() & isset() with arrays ***
1176 *** Testing unset(), empty() & isset() with resource variables ***
1209 *** Testing unset(), empty() & isset() with objects ***
1278 *** Testing possible variation in operation for isset(), empty() & unset() ***