Lines Matching refs:unset

2 Test unset(), empty() and isset() functions
5 /* Prototype: void unset ( mixed $var [, mixed $var [, mixed $...]] );
6 Description: unset() destroys the specified variables
15 echo "*** Testing unset(), empty() & isset() with scalar variables ***\n";
61 // destroy the variable using unset
62 unset( $scalar_var );
66 // check using isset to see if unset, expected: bool(false)
73 // isset() with two args, one arg only unset, expected: bool(false)
76 // isset() with two args, both args already unset, expected: bool(false);
77 unset($set_var);
81 echo "\n*** Testing unset(), empty() & isset() with arrays ***\n";
99 // check the isset and unset on non existing key
101 // try to unset the element which is non-existent
102 unset($array_var['non_existent']);
115 // unset each element in the array and see the working of unset, isset & empty
121 // unset the element
122 unset($array_var[$key_value]);
123 // dump the array after element was unset
125 // check using isset for the element that was unset
134 // because of using isset, empty and unset on its element
140 // unset the whole array
141 unset($array_var);
142 // dump the array to see its unset
152 echo "\n*** Testing unset(), emtpy() & isset() with resource variables ***\n";
175 // unset the resource
176 unset($resource);
183 unset($temp_var);
184 // now the isset() with both the args as unset
190 // unset and dump the array containing all the resources to see that
191 // unset works correctly
192 unset($resources);
197 echo "\n*** Testing unset(), empty() & isset() with objects ***\n";
218 // use unset/empty/isset to check the object
236 //unset a member and check
237 unset($point1->x);
238 // dump the point to see that variable was unset
243 // unset all members and check
244 unset($point1->y);
245 unset($point1->lable);
246 // dump the objec to check that all variables are unset
251 //unset the object and check
252 unset($point1);
255 // dump to see that object is unset
258 // try isset/unset/empty on a member function
262 unset($point2->testPoint);
271 /* testing variation in operation for isset(), empty() & unset().
272 Note: Most of the variation for function unset() is testing by a
276 echo "\n*** Testing possible variation in operation for isset(), empty() & unset() ***\n";
277 /* unset() variation1: checking unset on static variable inside a function.
278 * unset() destroys the variable only in the context of the rest of a function
281 echo "\n** Testing unset() variation 1: unset on static variable inside a function **\n";
288 echo "value of static_var before unset: $static_var\n";
293 // unset the static var
294 unset($static_var);
295 echo "value of static_var after unset: $static_var\n";
310 echo "\n** Testing unset() variation 2: unset on a variable passed by ref. inside of a function **\…
311 /* unset() variation2: Pass by reference
312 * If a variable that is PASSED BY REFERENCE is unset() inside of a function,
314 * will retain the same value as before unset() was called.
317 // unset the variable passed
318 unset($ref_val);
333 echo "\n** Testing unset() variation 3: unset on a global variable inside of a function **\n";
334 /* unset() variation2: unset on a global variable inside a function
335 * If a globalized variable is unset() inside of a function, only the
337 * will retain the same value as before unset() was called.
348 // unset the global var
349 unset($global_var);
365 *** Testing unset(), empty() & isset() with scalar variables ***
691 *** Testing unset(), empty() & isset() with arrays ***
1187 *** Testing unset(), emtpy() & isset() with resource variables ***
1220 *** Testing unset(), empty() & isset() with objects ***
1289 *** Testing possible variation in operation for isset(), empty() & unset() ***
1291 ** Testing unset() variation 1: unset on static variable inside a function **
1292 value of static_var before unset: 1
1297 value of static_var after unset:
1301 value of static_var before unset: 2
1306 value of static_var after unset:
1310 value of static_var before unset: 3
1315 value of static_var after unset:
1320 ** Testing unset() variation 2: unset on a variable passed by ref. inside of a function **
1326 ** Testing unset() variation 3: unset on a global variable inside of a function **