summaryrefslogtreecommitdiff
path: root/Zend/tests/019.phpt
blob: 0548a38f88364e215c3998279ec4d5ae48fa93d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
--TEST--
Test unset(), empty() and isset() functions
--FILE--
<?php
/* Prototype: void unset ( mixed $var [, mixed $var [, mixed $...]] );
   Description: unset() destroys the specified variables

   Prototype: bool empty( mixed $var );
   Description: Determine whether a variable is considered to be empty

   Prototype: bool isset ( mixed $var [, mixed $var [, $...]] );
   Description: Returns TRUE if var exists; FALSE otherwise
*/

echo "*** Testing unset(), empty() & isset() with scalar variables ***\n";

// testing scalar variables
$scalar_variables = array(
  0,    
  1,
  +1
  -1,
  0x55,
  -0xFA,
  0123,
  -0563,
  0.0,
  1e5,
  1E-5,
  -1.5e5,
  +5.6,
  "",
  '',
  " ",
  ' ',
  "string",
  "123",
  "0",
  "ture",
  "FALSE",
  "NULL",
  "null",
  true,
  false,
  TRUE,
  FALSE
);

$loop_counter = 1;
foreach ($scalar_variables as $scalar_var) {
  $set_var = 10; // this variable to use with isset
  echo "-- Iteration $loop_counter --\n"; $loop_counter++;

  // checking with isset before unsetting, expected: bool(true)
  var_dump( isset($scalar_var) ); 
  var_dump( isset($scalar_var, $set_var) );  
  // checking if the var is empty, expected: bool(false) on most
  // except "", 0, "0", NULL, FALSE
  var_dump( empty($scalar_var) );  
  
  // destroy the variable using unset
  unset( $scalar_var );   
  // dump and see if its destroyed, expcted: NULL 
  var_dump( $scalar_var ); 

  // check using isset to see if unset, expected: bool(false)
  var_dump( isset($scalar_var) ); 
  var_dump( isset($scalar_var, $set_var) ); 

  // empty to check if empty, expecting bool(true)
  var_dump( empty($scalar_var) ); 

  // isset() with two args, one arg only unset, expected: bool(false)
  var_dump( isset($scalar_var, $set_var) );

  // isset() with two args, both args already unset, expected: bool(false);
  unset($set_var);
  var_dump( isset($scalar_var, $set_var) );
}

echo "\n*** Testing unset(), empty() & isset() with arrays ***\n";
$array_variables = array(
  array(),
  array(NULL),
  array(0),
  array("0"),
  array(""),
  array(1,2,3,4),
  array(1.4,2.5,5.6),
  array(1 => "One", 2 => "two"),
  array("Name" => "Jack", "Age" => "30"),
  array(1,2, "One" => "1", 2 => "two", ""=>"empty", "" => '')
);  

$outer_loop_counter = 1;
foreach ($array_variables as $array_var) {
  echo "--- Outerloop Iteration $outer_loop_counter ---\n";
  
  // check the isset and unset on non existing key
  $var = 1;  // a var which is defined
  // try to unset the element which is non-existent
  unset($array_var['non_existent']); 
  // check using isset() & empty() on a non_existent element in the array
  var_dump( isset($array_var['non_existent']) );
  var_dump( isset($array_var['non_existent'], $var) );
  var_dump( isset($array_var['non_existent'], $array_var['none']) );
  var_dump( empty($array_var['non_existent']) );

  // testing empty and isset on arrays 
  var_dump( empty($array_var) ); // expecting bool(false), except: array(), which is considered empty
  var_dump( isset($array_var) ); // expecting bool(true), except: array(), which is not set

  // get the keys of the $array_var 
  $keys = array_keys($array_var);
  // unset each element in the array and see the working of unset, isset & empty
  $inner_loop_counter = 1;
  foreach ($keys as $key_value) {
    echo "-- Innerloop Iteration $inner_loop_counter of Outerloop Iteration $outer_loop_counter --\n"; 
    $inner_loop_counter++;

    // unset the element
    unset($array_var[$key_value]); 
    // dump the array after element was unset
    var_dump($array_var);
    // check using isset for the element that was unset
    var_dump( isset($array_var[$key_val]) ); // expected: bool(false)
    // calling isset with more args
    var_dump( isset($array_var[$key_val], $array_var) ); //expected: bool(false)

    // calling empty, expected bool(true) 
    var_dump( empty($array_var[$key_val]) );

    // dump the array to see that that array did not get modified 
    // because of using isset, empty and unset on its element
    var_dump($array_var);
  }

  $outer_loop_counter++;

  // unset the whole array
  unset($array_var);
  // dump the array to see its unset
  var_dump($array_var);
  // use isset to see that array is not set
  var_dump( isset($array_var) ); //expected: bool(false)
  var_dump( isset($array_var, $array_var[$key_val]) ); // expected: bool(false)
  
  // empty() to see if the array is empty
  var_dump( empty($array_var) ); // expected: bool(true)
}

echo "\n*** Testing unset(), emtpy() & isset() with resource variables ***\n";
$fp = fopen(__FILE__, "r");
$dfp = opendir( dirname(__FILE__) );
$resources = array (
  $fp,
  $dfp
);
$loop_counter = 1;
foreach ($resources as $resource) {
  $temp_var = 10;
  echo "-- Iteration $loop_counter --\n"; $loop_counter++;
  //dump the resource first
  var_dump($resource);

  // check using isset() and empty()
  var_dump( isset($resource) );  // expected: bool(true)
  var_dump( empty($resource) );  // expected: bool(false)
  // call isset() with two args, both set
  var_dump( isset($resource, $temp_var) ); // expected: bool(true)

  // dump the resource to see using isset() and empty () had no effect on it
  var_dump($resource);

  // unset the resource
  unset($resource);
  // check using isset() and empty()
  var_dump( isset($resource) );  // expected: bool(flase)
  var_dump( empty($resource) );  // expected: bool(true)
  // call isset() with two args, but one set
  var_dump( isset($resource, $temp_var) ); // expected: bool(false)
  // uset the temp_var
  unset($temp_var);
  // now the isset() with both the args as unset
  var_dump( isset($resource, $temp_var) ); // expected: bool(false);
  
  // dump the resource to see if there any effect on it 
  var_dump($resource);
}
// unset and dump the array containing all the resources to see that
// unset works correctly 
unset($resources);
var_dump($resources);
var_dump( isset($resources) );  //expected: bool(false)
var_dump( empty($resources) );  // expected: bool(true)

echo "\n*** Testing unset(), empty() & isset() with objects ***\n";
class Point
{
  var $x;
  var $y;
  var $lable;
  
  function __construct($x, $y) {
    $this->x = $x;
    $this->y = $y;
  }
  
  function setLable($lable) {
    $this->lable = $lable;
  }
  function testPoint() {
    echo "\nPoint::testPoint() called\n";
  }
}
$point1 = new Point(30,40);

// use unset/empty/isset to check the object 
var_dump($point1); // dump the object 

// check the object and member that is not set
var_dump( isset($point1) );  // expected: bool(true)
var_dump( empty($point1) );  // expected: bool(false)
var_dump( isset($point1->$lable) );  //expected: bool(flase)
var_dump( empty($point1->$lable) );  //expected: bool(true)

//set the member variable lable and check
$point1->setLable("Point1");
var_dump( isset($point1->$lable) );  //expected: bool(true)
var_dump( empty($point1->$lable) );  //expected: bool(false)

// dump the object to see that obj was not harmed 
// because of the usage of the isset & empty
var_dump($point1);

//unset a member and check
unset($point1->x);
// dump the point to see that variable was unset
var_dump($point1);
var_dump( isset($point1->x) );  // expected: bool(false)
var_dump( empty($point1->x) );  // expected: bool(true)

// unset all members and check
unset($point1->y);
unset($point1->lable);
// dump the objec to check that all variables are unset
var_dump($point1);
var_dump( isset($point1) );  // expected: bool(ture)
var_dump( empty($point1) );  // expected: bool(false)

//unset the object and check
unset($point1);
var_dump( isset($point1) );  // expected: bool(false)
var_dump( empty($point1) );  // expected: bool(true)
// dump to see that object is unset
var_dump($point1);

// try isset/unset/empty on a member function
$point2 = new Point(5,6);
var_dump( isset($point2->testPoint) );
var_dump( empty($point2->testPoint) );
unset($point2->testPoint);
var_dump( isset($point2->testPoint) );
var_dump( empty($point2->testPoint) );

// use get_class_methods to see effect if any
var_dump( get_class_methods($point2) );
// dump the object to see the effect, none expected
var_dump($point2);

/* testing variation in operation for isset(), empty() & unset().
Note: Most of the variation for function unset() is testing by a
      set of testcases named "Zend/tests/unset_cv??.phpt", only 
      variation not tested are attempted here */

echo "\n*** Testing possible variation in operation for isset(), empty() & unset() ***\n";
/* unset() variation1: checking unset on static variable inside a function. 
 * unset() destroys the variable only in the context of the rest of a function
 * Following calls will restore the previous value of a variable.
 */
echo "\n** Testing unset() variation 1: unset on static variable inside a function **\n";
function test_unset1() {
  static $static_var;
  
  // increment the value of the static. this change is in function context
  $static_var ++;
 
  echo "value of static_var before unset: $static_var\n"; 
  // check using isset and empty 
  var_dump( isset($static_var) );
  var_dump( empty($static_var) );
  
  // unset the static var
  unset($static_var);
  echo "value of static_var after unset: $static_var\n"; 
  // check using isset and empty 
  var_dump( isset($static_var) );
  var_dump( empty($static_var) );

  // assign a value to static var
  $static_var = 20;
  echo "value of static_var after new assignment: $static_var\n"; 
}
// call the functiont
test_unset1();
test_unset1();
test_unset1();


echo "\n** Testing unset() variation 2: unset on a variable passed by ref. inside of a function **\n";
/* unset() variation2: Pass by reference  
 * If a variable that is PASSED BY REFERENCE is unset() inside of a function, 
 * only the local variable is destroyed. The variable in the calling environment
 * will retain the same value as before unset()  was called. 
 */
function test_unset2( &$ref_val ) {
  // unset the variable passed
  unset($ref_val);
  // check using isset and empty to confirm
  var_dump( isset($ref_val) );
  var_dump( empty($ref_val) );

  // set the value ot a new one
  $ref_val = "new value by ref";
}

$value = "value";
var_dump($value);
test_unset2($value);
var_dump($value);

 
echo "\n** Testing unset() variation 3: unset on a global variable inside of a function **\n";
/* unset() variation2: unset on a global variable inside a function
 * If a globalized variable is unset() inside of a function, only the
 * local variable is destroyed. The variable in the calling environment
 * will retain the same value as before unset() was called.
 */
$global_var = 10;

function test_unset3() {
  global $global_var;
   
  // check the $global_var using isset and empty 
  var_dump( isset($global_var) ); 
  var_dump( empty($global_var) ); 
 
  // unset the global var
  unset($global_var);
 
  // check the $global_var using isset and empty 
  var_dump( isset($global_var) ); 
  var_dump( empty($global_var) ); 
}

var_dump($global_var);
test_unset3();
var_dump($global_var);

//Note: No error conditions relating to passing arguments can be tested
// because these are not functions but statements, it will result in syntax error.
?>
===DONE===
--EXPECTF--
*** Testing unset(), empty() & isset() with scalar variables ***
-- Iteration 1 --
bool(true)
bool(true)
bool(true)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 2 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 3 --
bool(true)
bool(true)
bool(true)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 4 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 5 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 6 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 7 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 8 --
bool(true)
bool(true)
bool(true)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 9 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 10 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 11 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 12 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 13 --
bool(true)
bool(true)
bool(true)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 14 --
bool(true)
bool(true)
bool(true)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 15 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 16 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 17 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 18 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 19 --
bool(true)
bool(true)
bool(true)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 20 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 21 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 22 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 23 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 24 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 25 --
bool(true)
bool(true)
bool(true)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 26 --
bool(true)
bool(true)
bool(false)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)
-- Iteration 27 --
bool(true)
bool(true)
bool(true)

Notice: Undefined variable: scalar_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
bool(false)
bool(false)

*** Testing unset(), empty() & isset() with arrays ***
--- Outerloop Iteration 1 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(true)
bool(true)

Notice: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
--- Outerloop Iteration 2 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(true)
-- Innerloop Iteration 1 of Outerloop Iteration 2 --
array(0) {
}

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(0) {
}

Notice: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
--- Outerloop Iteration 3 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(true)
-- Innerloop Iteration 1 of Outerloop Iteration 3 --
array(0) {
}

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(0) {
}

Notice: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
--- Outerloop Iteration 4 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(true)
-- Innerloop Iteration 1 of Outerloop Iteration 4 --
array(0) {
}

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(0) {
}

Notice: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
--- Outerloop Iteration 5 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(true)
-- Innerloop Iteration 1 of Outerloop Iteration 5 --
array(0) {
}

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(0) {
}

Notice: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
--- Outerloop Iteration 6 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(true)
-- Innerloop Iteration 1 of Outerloop Iteration 6 --
array(3) {
  [1]=>
  int(2)
  [2]=>
  int(3)
  [3]=>
  int(4)
}

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(3) {
  [1]=>
  int(2)
  [2]=>
  int(3)
  [3]=>
  int(4)
}
-- Innerloop Iteration 2 of Outerloop Iteration 6 --
array(2) {
  [2]=>
  int(3)
  [3]=>
  int(4)
}

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(2) {
  [2]=>
  int(3)
  [3]=>
  int(4)
}
-- Innerloop Iteration 3 of Outerloop Iteration 6 --
array(1) {
  [3]=>
  int(4)
}

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(1) {
  [3]=>
  int(4)
}
-- Innerloop Iteration 4 of Outerloop Iteration 6 --
array(0) {
}

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(0) {
}

Notice: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
--- Outerloop Iteration 7 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(true)
-- Innerloop Iteration 1 of Outerloop Iteration 7 --
array(2) {
  [1]=>
  float(2.5)
  [2]=>
  float(5.6)
}

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(2) {
  [1]=>
  float(2.5)
  [2]=>
  float(5.6)
}
-- Innerloop Iteration 2 of Outerloop Iteration 7 --
array(1) {
  [2]=>
  float(5.6)
}

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(1) {
  [2]=>
  float(5.6)
}
-- Innerloop Iteration 3 of Outerloop Iteration 7 --
array(0) {
}

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(0) {
}

Notice: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
--- Outerloop Iteration 8 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(true)
-- Innerloop Iteration 1 of Outerloop Iteration 8 --
array(1) {
  [2]=>
  string(3) "two"
}

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(1) {
  [2]=>
  string(3) "two"
}
-- Innerloop Iteration 2 of Outerloop Iteration 8 --
array(0) {
}

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(0) {
}

Notice: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
--- Outerloop Iteration 9 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(true)
-- Innerloop Iteration 1 of Outerloop Iteration 9 --
array(1) {
  ["Age"]=>
  string(2) "30"
}

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(1) {
  ["Age"]=>
  string(2) "30"
}
-- Innerloop Iteration 2 of Outerloop Iteration 9 --
array(0) {
}

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(0) {
}

Notice: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)
--- Outerloop Iteration 10 ---
bool(false)
bool(false)
bool(false)
bool(true)
bool(false)
bool(true)
-- Innerloop Iteration 1 of Outerloop Iteration 10 --
array(4) {
  [1]=>
  int(2)
  ["One"]=>
  string(1) "1"
  [2]=>
  string(3) "two"
  [""]=>
  string(0) ""
}

Notice: Undefined variable: key_val in %s on line %d
bool(true)

Notice: Undefined variable: key_val in %s on line %d
bool(true)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(4) {
  [1]=>
  int(2)
  ["One"]=>
  string(1) "1"
  [2]=>
  string(3) "two"
  [""]=>
  string(0) ""
}
-- Innerloop Iteration 2 of Outerloop Iteration 10 --
array(3) {
  ["One"]=>
  string(1) "1"
  [2]=>
  string(3) "two"
  [""]=>
  string(0) ""
}

Notice: Undefined variable: key_val in %s on line %d
bool(true)

Notice: Undefined variable: key_val in %s on line %d
bool(true)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(3) {
  ["One"]=>
  string(1) "1"
  [2]=>
  string(3) "two"
  [""]=>
  string(0) ""
}
-- Innerloop Iteration 3 of Outerloop Iteration 10 --
array(2) {
  [2]=>
  string(3) "two"
  [""]=>
  string(0) ""
}

Notice: Undefined variable: key_val in %s on line %d
bool(true)

Notice: Undefined variable: key_val in %s on line %d
bool(true)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(2) {
  [2]=>
  string(3) "two"
  [""]=>
  string(0) ""
}
-- Innerloop Iteration 4 of Outerloop Iteration 10 --
array(1) {
  [""]=>
  string(0) ""
}

Notice: Undefined variable: key_val in %s on line %d
bool(true)

Notice: Undefined variable: key_val in %s on line %d
bool(true)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(1) {
  [""]=>
  string(0) ""
}
-- Innerloop Iteration 5 of Outerloop Iteration 10 --
array(0) {
}

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(false)

Notice: Undefined variable: key_val in %s on line %d
bool(true)
array(0) {
}

Notice: Undefined variable: array_var in %s on line %d
NULL
bool(false)
bool(false)
bool(true)

*** Testing unset(), emtpy() & isset() with resource variables ***
-- Iteration 1 --
resource(%d) of type (stream)
bool(true)
bool(false)
bool(true)
resource(%d) of type (stream)
bool(false)
bool(true)
bool(false)
bool(false)

Notice: Undefined variable: resource in %s on line %d
NULL
-- Iteration 2 --
resource(%d) of type (stream)
bool(true)
bool(false)
bool(true)
resource(%d) of type (stream)
bool(false)
bool(true)
bool(false)
bool(false)

Notice: Undefined variable: resource in %s on line %d
NULL

Notice: Undefined variable: resources in %s on line %d
NULL
bool(false)
bool(true)

*** Testing unset(), empty() & isset() with objects ***
object(Point)#%d (3) {
  ["x"]=>
  int(30)
  ["y"]=>
  int(40)
  ["lable"]=>
  NULL
}
bool(true)
bool(false)

Notice: Undefined variable: lable in %s on line %d
bool(false)

Notice: Undefined variable: lable in %s on line %d
bool(true)

Notice: Undefined variable: lable in %s on line %d
bool(false)

Notice: Undefined variable: lable in %s on line %d
bool(true)
object(Point)#%d (3) {
  ["x"]=>
  int(30)
  ["y"]=>
  int(40)
  ["lable"]=>
  string(6) "Point1"
}
object(Point)#%d (2) {
  ["y"]=>
  int(40)
  ["lable"]=>
  string(6) "Point1"
}
bool(false)
bool(true)
object(Point)#%d (0) {
}
bool(true)
bool(false)
bool(false)
bool(true)

Notice: Undefined variable: point1 in %s on line %d
NULL
bool(false)
bool(true)
bool(false)
bool(true)
array(3) {
  [0]=>
  string(11) "__construct"
  [1]=>
  string(8) "setLable"
  [2]=>
  string(9) "testPoint"
}
object(Point)#%d (3) {
  ["x"]=>
  int(5)
  ["y"]=>
  int(6)
  ["lable"]=>
  NULL
}

*** Testing possible variation in operation for isset(), empty() & unset() ***

** Testing unset() variation 1: unset on static variable inside a function **
value of static_var before unset: 1
bool(true)
bool(false)

Notice: Undefined variable: static_var in %s on line %d
value of static_var after unset: 
bool(false)
bool(true)
value of static_var after new assignment: 20
value of static_var before unset: 2
bool(true)
bool(false)

Notice: Undefined variable: static_var in %s on line %d
value of static_var after unset: 
bool(false)
bool(true)
value of static_var after new assignment: 20
value of static_var before unset: 3
bool(true)
bool(false)

Notice: Undefined variable: static_var in %s on line %d
value of static_var after unset: 
bool(false)
bool(true)
value of static_var after new assignment: 20

** Testing unset() variation 2: unset on a variable passed by ref. inside of a function **
string(5) "value"
bool(false)
bool(true)
string(5) "value"

** Testing unset() variation 3: unset on a global variable inside of a function **
int(10)
bool(true)
bool(false)
bool(false)
bool(true)
int(10)
===DONE===