]> granicus.if.org Git - php/blob
3f24a5bc9d
[php] /
1 --TEST--
2 Test print_r() function
3 --INI--
4 precision=14
5 --FILE--
6 <?php
7 /* Prototype: bool print_r ( mixed $expression [, bool $return] );
8    Description: Prints human-readable information about a variable
9 */
10
11 /* Prototype: void check_printr( $variables )
12    Description: use print_r() to print variables */
13 function check_printr( $variables ) {
14   $counter = 1;
15   foreach( $variables as $variable ) {
16     echo "\n-- Iteration $counter --\n";
17     //default = false, prints output to screen
18     print_r($variable);
19     //$return=TRUE, print_r() will return its output, instead of printing it
20     $ret_string = print_r($variable, true); //$ret_string captures the output
21     echo "\n$ret_string\n";
22     //$return=false, print_r() prints the output; default behavior
23     print_r($variable, false);
24     $counter++;
25   }
26 }
27
28 echo "\n*** Testing print_r() on integer variables ***\n";
29 $integers = array (
30   0,  // zero as argument
31   000000123,  //octal value of 83
32   123000000,
33   -00000123,  //octal value of 83
34   -12300000,
35   range(1,10),  // positive values
36   range(-1,-10),  // negative values
37   +2147483647,  // max positive integer
38   +2147483648,  // max positive integer + 1
39   -2147483648,  // min range of integer
40   -2147483647,  // min range of integer + 1
41   0x7FFFFFFF,  // max positive hexadecimal integer
42   -0x80000000,  // min range of hexadecimal integer
43   017777777777,  // max posotive octal integer
44   -020000000000  // min range of octal integer
45 );
46 /* calling check_printr() to display contents of integer variables
47    using print_r() */
48 check_printr($integers);
49
50 echo "\n*** Testing print_r() on float variables ***\n";
51 $floats = array (
52   -0.0,
53   +0.0,
54   1.234,
55   -1.234,
56   -2.000000,
57   000002.00,
58   -.5,
59   .567,
60   -.6700000e-3,
61   -.6700000E+3,
62   .6700000E+3,
63   .6700000e+3,
64   -4.10003e-3,
65   -4.10003E+3,
66   4.100003e-3,
67   4.100003E+3,
68   1e5,
69   -1e5,
70   1e-5,
71   -1e-5,
72   1e+5,
73   -1e+5,
74   1E5,
75   -1E5,
76   1E+5,
77   -1E+5,
78   1E-5,
79   -1E-5,
80   -0x80000001,  // float value, beyond max negative int
81   0x80000001,  // float value, beyond max positive int
82   020000000001,  // float value, beyond max positive int
83   -020000000001  // float value, beyond max negative int
84 );
85 /* calling check_printr() to display contents of float variables
86    using print_r() */
87 check_printr($floats);
88
89 echo "\n*** Testing print_r() on string variables ***\n";
90 $strings = array (
91   "",
92   '',
93   " ",
94   ' ',
95   "0",
96   "\0",
97   '\0',
98   "\t",
99   '\t',
100   "PHP",
101   'PHP',
102   "abcd\x0n1234\x0005678\x0000efgh\xijkl",  // strings with hexadecimal NULL
103   "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz",  // strings with octal NULL
104   "1234\t\n5678\n\t9100\"abcda"  // strings with escape characters
105 );
106 /* calling check_printr() to display contents of strings using print_r() */
107 check_printr($strings);
108
109 echo "\n*** Testing print_r() on boolean variables ***\n";
110 $booleans = array (
111   TRUE,
112   FALSE,
113   true,
114   false
115 );
116 /* calling check_printr() to display boolean variables using print_r() */
117 check_printr($booleans);
118 var_dump( reset($booleans) );
119 echo "\n";
120 var_dump( current($booleans) );
121
122 echo "\n*** Testing print_r() on array variables ***\n";
123 $arrays = array (
124   array(),
125   array(NULL),
126   array(null),
127   array(true),
128   array(""),
129   array(''),
130   array(array(), array()),
131   array(array(1, 2), array('a', 'b')),
132   array(1 => 'One'),
133   array("test" => "is_array"),
134   array(0),
135   array(-1),
136   array(10.5, 5.6),
137   array("string", "test"),
138   array('string', 'test'),
139 );
140 /* calling check_printr() to display contents of $arrays */
141 check_printr($arrays);
142
143 echo "\n*** Testing print_r() on object variables ***\n";
144 class object_class
145 {
146   var       $value;
147   public    $public_var1 = 10;
148   private   $private_var1 = 20;
149   private   $private_var2;
150   protected $protected_var1 = "string_1";
151   protected $protected_var2;
152
153   function __construct() {
154     $this->value = 50;
155     $this->public_var2 = 11;
156     $this->private_var2 = 21;
157     $this->protected_var2 = "string_2";
158   }
159
160   public function foo1() {
161     echo "foo1() is called\n";
162   }
163   protected function foo2() {
164     echo "foo2() is called\n";
165   }
166   private function foo3() {
167     echo "foo3() is called\n";
168   }
169 }
170 /* class with no member */
171 class no_member_class {
172  // no members
173 }
174
175 /* class with member as object of other class */
176 class contains_object_class
177 {
178    var       $p = 30;
179    var       $class_object1;
180    public    $class_object2;
181    private   $class_object3;
182    protected $class_object4;
183    var       $no_member_class_object;
184
185    public function func() {
186      echo "func() is called \n";
187    }
188
189    function __construct() {
190      $this->class_object1 = new object_class();
191      $this->class_object2 = new object_class();
192      $this->class_object3 = $this->class_object1;
193      $this->class_object4 = $this->class_object2;
194      $this->no_member_class_object = new no_member_class();
195      $this->class_object5 = $this;   //recursive reference
196    }
197 }
198
199 /* objects of different classes */
200 $obj = new contains_object_class;
201 $temp_class_obj = new object_class();
202
203 /* object which is unset */
204 $unset_obj = new object_class();
205 unset($unset_obj);
206
207 $objects = array (
208   new object_class,
209   new no_member_class,
210   new contains_object_class,
211   $obj,
212   $obj->class_object1,
213   $obj->class_object2,
214   $obj->no_member_class_object,
215   $temp_class_obj,
216   @$unset_obj
217 );
218 /* calling check_printr() to display contents of the objects using print_r() */
219 check_printr($objects);
220
221 echo "\n** Testing print_r() on objects having circular reference **\n";
222 $recursion_obj1 = new object_class();
223 $recursion_obj2 = new object_class();
224 $recursion_obj1->obj = &$recursion_obj2;  //circular reference
225 $recursion_obj2->obj = &$recursion_obj1;  //circular reference
226 print_r($recursion_obj2);
227
228 echo "\n*** Testing print_r() on resources ***\n";
229 /* file type resource */
230 $file_handle = fopen(__FILE__, "r");
231
232 /* directory type resource */
233 $dir_handle = opendir( __DIR__ );
234
235 $resources = array (
236   $file_handle,
237   $dir_handle
238 );
239 /* calling check_printr() to display the resource content type
240    using print_r() */
241 check_printr($resources);
242
243 echo "\n*** Testing print_r() on different combinations of scalar
244     and non-scalar variables ***\n";
245 /* a variable which is unset */
246 $unset_var = 10.5;
247 unset($unset_var);
248
249 /* unset file type resource */
250 unset($file_handle);
251
252 $variations = array (
253   array( 123, -1.2345, "a" ),
254   array( "d", array(1, 3, 5), true, null),
255   array( new no_member_class, array(), false, 0 ),
256   array( -0.00, "Where am I?", array(7,8,9), TRUE, 'A', 987654321 ),
257   array( @$unset_var, 2.E+10, 100-20.9, 000004.599998 ),  //unusual data
258   array( "array(1,2,3,4)1.0000002TRUE", @$file_handle, 111333.00+45e5, '/00\7')
259 );
260 /* calling check_printr() to display combinations of scalar and
261    non-scalar variables using print_r() */
262 check_printr($variations);
263
264 echo "\n*** Testing print_r() on miscellaneous input arguments ***\n";
265 $misc_values = array (
266   @$unset_var,
267   NULL,  // NULL argument
268   @$undef_variable,  //undefined variable
269   null
270 );
271 /* calling check_printr() to display miscellaneous data using print_r() */
272 check_printr($misc_values);
273
274 /* closing resource handle used */
275 closedir($dir_handle);
276
277 echo "Done\n";
278 ?>
279 --EXPECTF--
280 *** Testing print_r() on integer variables ***
281
282 -- Iteration 1 --
283 0
284 0
285 0
286 -- Iteration 2 --
287 83
288 83
289 83
290 -- Iteration 3 --
291 123000000
292 123000000
293 123000000
294 -- Iteration 4 --
295 -83
296 -83
297 -83
298 -- Iteration 5 --
299 -12300000
300 -12300000
301 -12300000
302 -- Iteration 6 --
303 Array
304 (
305     [0] => 1
306     [1] => 2
307     [2] => 3
308     [3] => 4
309     [4] => 5
310     [5] => 6
311     [6] => 7
312     [7] => 8
313     [8] => 9
314     [9] => 10
315 )
316
317 Array
318 (
319     [0] => 1
320     [1] => 2
321     [2] => 3
322     [3] => 4
323     [4] => 5
324     [5] => 6
325     [6] => 7
326     [7] => 8
327     [8] => 9
328     [9] => 10
329 )
330
331 Array
332 (
333     [0] => 1
334     [1] => 2
335     [2] => 3
336     [3] => 4
337     [4] => 5
338     [5] => 6
339     [6] => 7
340     [7] => 8
341     [8] => 9
342     [9] => 10
343 )
344
345 -- Iteration 7 --
346 Array
347 (
348     [0] => -1
349     [1] => -2
350     [2] => -3
351     [3] => -4
352     [4] => -5
353     [5] => -6
354     [6] => -7
355     [7] => -8
356     [8] => -9
357     [9] => -10
358 )
359
360 Array
361 (
362     [0] => -1
363     [1] => -2
364     [2] => -3
365     [3] => -4
366     [4] => -5
367     [5] => -6
368     [6] => -7
369     [7] => -8
370     [8] => -9
371     [9] => -10
372 )
373
374 Array
375 (
376     [0] => -1
377     [1] => -2
378     [2] => -3
379     [3] => -4
380     [4] => -5
381     [5] => -6
382     [6] => -7
383     [7] => -8
384     [8] => -9
385     [9] => -10
386 )
387
388 -- Iteration 8 --
389 2147483647
390 2147483647
391 2147483647
392 -- Iteration 9 --
393 2147483648
394 2147483648
395 2147483648
396 -- Iteration 10 --
397 -2147483648
398 -2147483648
399 -2147483648
400 -- Iteration 11 --
401 -2147483647
402 -2147483647
403 -2147483647
404 -- Iteration 12 --
405 2147483647
406 2147483647
407 2147483647
408 -- Iteration 13 --
409 -2147483648
410 -2147483648
411 -2147483648
412 -- Iteration 14 --
413 2147483647
414 2147483647
415 2147483647
416 -- Iteration 15 --
417 -2147483648
418 -2147483648
419 -2147483648
420 *** Testing print_r() on float variables ***
421
422 -- Iteration 1 --
423 -0
424 -0
425 -0
426 -- Iteration 2 --
427 0
428 0
429 0
430 -- Iteration 3 --
431 1.234
432 1.234
433 1.234
434 -- Iteration 4 --
435 -1.234
436 -1.234
437 -1.234
438 -- Iteration 5 --
439 -2
440 -2
441 -2
442 -- Iteration 6 --
443 2
444 2
445 2
446 -- Iteration 7 --
447 -0.5
448 -0.5
449 -0.5
450 -- Iteration 8 --
451 0.567
452 0.567
453 0.567
454 -- Iteration 9 --
455 -0.00067
456 -0.00067
457 -0.00067
458 -- Iteration 10 --
459 -670
460 -670
461 -670
462 -- Iteration 11 --
463 670
464 670
465 670
466 -- Iteration 12 --
467 670
468 670
469 670
470 -- Iteration 13 --
471 -0.00410003
472 -0.00410003
473 -0.00410003
474 -- Iteration 14 --
475 -4100.03
476 -4100.03
477 -4100.03
478 -- Iteration 15 --
479 0.004100003
480 0.004100003
481 0.004100003
482 -- Iteration 16 --
483 4100.003
484 4100.003
485 4100.003
486 -- Iteration 17 --
487 100000
488 100000
489 100000
490 -- Iteration 18 --
491 -100000
492 -100000
493 -100000
494 -- Iteration 19 --
495 1.0E-5
496 1.0E-5
497 1.0E-5
498 -- Iteration 20 --
499 -1.0E-5
500 -1.0E-5
501 -1.0E-5
502 -- Iteration 21 --
503 100000
504 100000
505 100000
506 -- Iteration 22 --
507 -100000
508 -100000
509 -100000
510 -- Iteration 23 --
511 100000
512 100000
513 100000
514 -- Iteration 24 --
515 -100000
516 -100000
517 -100000
518 -- Iteration 25 --
519 100000
520 100000
521 100000
522 -- Iteration 26 --
523 -100000
524 -100000
525 -100000
526 -- Iteration 27 --
527 1.0E-5
528 1.0E-5
529 1.0E-5
530 -- Iteration 28 --
531 -1.0E-5
532 -1.0E-5
533 -1.0E-5
534 -- Iteration 29 --
535 -2147483649
536 -2147483649
537 -2147483649
538 -- Iteration 30 --
539 2147483649
540 2147483649
541 2147483649
542 -- Iteration 31 --
543 2147483649
544 2147483649
545 2147483649
546 -- Iteration 32 --
547 -2147483649
548 -2147483649
549 -2147483649
550 *** Testing print_r() on string variables ***
551
552 -- Iteration 1 --
553
554
555
556 -- Iteration 2 --
557
558
559
560 -- Iteration 3 --
561  
562  
563  
564 -- Iteration 4 --
565  
566  
567  
568 -- Iteration 5 --
569 0
570 0
571 0
572 -- Iteration 6 --
573 \0
574 \0
575 \0
576 -- Iteration 7 --
577 \0
578 \0
579 \0
580 -- Iteration 8 --
581         
582         
583         
584 -- Iteration 9 --
585 \t
586 \t
587 \t
588 -- Iteration 10 --
589 PHP
590 PHP
591 PHP
592 -- Iteration 11 --
593 PHP
594 PHP
595 PHP
596 -- Iteration 12 --
597 abcd\0n1234\005678\000efgh\xijkl
598 abcd\0n1234\005678\000efgh\xijkl
599 abcd\0n1234\005678\000efgh\xijkl
600 -- Iteration 13 --
601 abcd\0efgh\0ijkl\0mnop\00qrst\0uvwx\00yz
602 abcd\0efgh\0ijkl\0mnop\00qrst\0uvwx\00yz
603 abcd\0efgh\0ijkl\0mnop\00qrst\0uvwx\00yz
604 -- Iteration 14 --
605 1234    
606 5678
607         9100"abcda
608 1234    
609 5678
610         9100"abcda
611 1234    
612 5678
613         9100"abcda
614 *** Testing print_r() on boolean variables ***
615
616 -- Iteration 1 --
617 1
618 1
619 1
620 -- Iteration 2 --
621
622
623
624 -- Iteration 3 --
625 1
626 1
627 1
628 -- Iteration 4 --
629
630
631 bool(true)
632
633 bool(true)
634
635 *** Testing print_r() on array variables ***
636
637 -- Iteration 1 --
638 Array
639 (
640 )
641
642 Array
643 (
644 )
645
646 Array
647 (
648 )
649
650 -- Iteration 2 --
651 Array
652 (
653     [0] => 
654 )
655
656 Array
657 (
658     [0] => 
659 )
660
661 Array
662 (
663     [0] => 
664 )
665
666 -- Iteration 3 --
667 Array
668 (
669     [0] => 
670 )
671
672 Array
673 (
674     [0] => 
675 )
676
677 Array
678 (
679     [0] => 
680 )
681
682 -- Iteration 4 --
683 Array
684 (
685     [0] => 1
686 )
687
688 Array
689 (
690     [0] => 1
691 )
692
693 Array
694 (
695     [0] => 1
696 )
697
698 -- Iteration 5 --
699 Array
700 (
701     [0] => 
702 )
703
704 Array
705 (
706     [0] => 
707 )
708
709 Array
710 (
711     [0] => 
712 )
713
714 -- Iteration 6 --
715 Array
716 (
717     [0] => 
718 )
719
720 Array
721 (
722     [0] => 
723 )
724
725 Array
726 (
727     [0] => 
728 )
729
730 -- Iteration 7 --
731 Array
732 (
733     [0] => Array
734         (
735         )
736
737     [1] => Array
738         (
739         )
740
741 )
742
743 Array
744 (
745     [0] => Array
746         (
747         )
748
749     [1] => Array
750         (
751         )
752
753 )
754
755 Array
756 (
757     [0] => Array
758         (
759         )
760
761     [1] => Array
762         (
763         )
764
765 )
766
767 -- Iteration 8 --
768 Array
769 (
770     [0] => Array
771         (
772             [0] => 1
773             [1] => 2
774         )
775
776     [1] => Array
777         (
778             [0] => a
779             [1] => b
780         )
781
782 )
783
784 Array
785 (
786     [0] => Array
787         (
788             [0] => 1
789             [1] => 2
790         )
791
792     [1] => Array
793         (
794             [0] => a
795             [1] => b
796         )
797
798 )
799
800 Array
801 (
802     [0] => Array
803         (
804             [0] => 1
805             [1] => 2
806         )
807
808     [1] => Array
809         (
810             [0] => a
811             [1] => b
812         )
813
814 )
815
816 -- Iteration 9 --
817 Array
818 (
819     [1] => One
820 )
821
822 Array
823 (
824     [1] => One
825 )
826
827 Array
828 (
829     [1] => One
830 )
831
832 -- Iteration 10 --
833 Array
834 (
835     [test] => is_array
836 )
837
838 Array
839 (
840     [test] => is_array
841 )
842
843 Array
844 (
845     [test] => is_array
846 )
847
848 -- Iteration 11 --
849 Array
850 (
851     [0] => 0
852 )
853
854 Array
855 (
856     [0] => 0
857 )
858
859 Array
860 (
861     [0] => 0
862 )
863
864 -- Iteration 12 --
865 Array
866 (
867     [0] => -1
868 )
869
870 Array
871 (
872     [0] => -1
873 )
874
875 Array
876 (
877     [0] => -1
878 )
879
880 -- Iteration 13 --
881 Array
882 (
883     [0] => 10.5
884     [1] => 5.6
885 )
886
887 Array
888 (
889     [0] => 10.5
890     [1] => 5.6
891 )
892
893 Array
894 (
895     [0] => 10.5
896     [1] => 5.6
897 )
898
899 -- Iteration 14 --
900 Array
901 (
902     [0] => string
903     [1] => test
904 )
905
906 Array
907 (
908     [0] => string
909     [1] => test
910 )
911
912 Array
913 (
914     [0] => string
915     [1] => test
916 )
917
918 -- Iteration 15 --
919 Array
920 (
921     [0] => string
922     [1] => test
923 )
924
925 Array
926 (
927     [0] => string
928     [1] => test
929 )
930
931 Array
932 (
933     [0] => string
934     [1] => test
935 )
936
937 *** Testing print_r() on object variables ***
938
939 -- Iteration 1 --
940 object_class Object
941 (
942     [value] => 50
943     [public_var1] => 10
944     [private_var1:object_class:private] => 20
945     [private_var2:object_class:private] => 21
946     [protected_var1:protected] => string_1
947     [protected_var2:protected] => string_2
948     [public_var2] => 11
949 )
950
951 object_class Object
952 (
953     [value] => 50
954     [public_var1] => 10
955     [private_var1:object_class:private] => 20
956     [private_var2:object_class:private] => 21
957     [protected_var1:protected] => string_1
958     [protected_var2:protected] => string_2
959     [public_var2] => 11
960 )
961
962 object_class Object
963 (
964     [value] => 50
965     [public_var1] => 10
966     [private_var1:object_class:private] => 20
967     [private_var2:object_class:private] => 21
968     [protected_var1:protected] => string_1
969     [protected_var2:protected] => string_2
970     [public_var2] => 11
971 )
972
973 -- Iteration 2 --
974 no_member_class Object
975 (
976 )
977
978 no_member_class Object
979 (
980 )
981
982 no_member_class Object
983 (
984 )
985
986 -- Iteration 3 --
987 contains_object_class Object
988 (
989     [p] => 30
990     [class_object1] => object_class Object
991         (
992             [value] => 50
993             [public_var1] => 10
994             [private_var1:object_class:private] => 20
995             [private_var2:object_class:private] => 21
996             [protected_var1:protected] => string_1
997             [protected_var2:protected] => string_2
998             [public_var2] => 11
999         )
1000
1001     [class_object2] => object_class Object
1002         (
1003             [value] => 50
1004             [public_var1] => 10
1005             [private_var1:object_class:private] => 20
1006             [private_var2:object_class:private] => 21
1007             [protected_var1:protected] => string_1
1008             [protected_var2:protected] => string_2
1009             [public_var2] => 11
1010         )
1011
1012     [class_object3:contains_object_class:private] => object_class Object
1013         (
1014             [value] => 50
1015             [public_var1] => 10
1016             [private_var1:object_class:private] => 20
1017             [private_var2:object_class:private] => 21
1018             [protected_var1:protected] => string_1
1019             [protected_var2:protected] => string_2
1020             [public_var2] => 11
1021         )
1022
1023     [class_object4:protected] => object_class Object
1024         (
1025             [value] => 50
1026             [public_var1] => 10
1027             [private_var1:object_class:private] => 20
1028             [private_var2:object_class:private] => 21
1029             [protected_var1:protected] => string_1
1030             [protected_var2:protected] => string_2
1031             [public_var2] => 11
1032         )
1033
1034     [no_member_class_object] => no_member_class Object
1035         (
1036         )
1037
1038     [class_object5] => contains_object_class Object
1039  *RECURSION*
1040 )
1041
1042 contains_object_class Object
1043 (
1044     [p] => 30
1045     [class_object1] => object_class Object
1046         (
1047             [value] => 50
1048             [public_var1] => 10
1049             [private_var1:object_class:private] => 20
1050             [private_var2:object_class:private] => 21
1051             [protected_var1:protected] => string_1
1052             [protected_var2:protected] => string_2
1053             [public_var2] => 11
1054         )
1055
1056     [class_object2] => object_class Object
1057         (
1058             [value] => 50
1059             [public_var1] => 10
1060             [private_var1:object_class:private] => 20
1061             [private_var2:object_class:private] => 21
1062             [protected_var1:protected] => string_1
1063             [protected_var2:protected] => string_2
1064             [public_var2] => 11
1065         )
1066
1067     [class_object3:contains_object_class:private] => object_class Object
1068         (
1069             [value] => 50
1070             [public_var1] => 10
1071             [private_var1:object_class:private] => 20
1072             [private_var2:object_class:private] => 21
1073             [protected_var1:protected] => string_1
1074             [protected_var2:protected] => string_2
1075             [public_var2] => 11
1076         )
1077
1078     [class_object4:protected] => object_class Object
1079         (
1080             [value] => 50
1081             [public_var1] => 10
1082             [private_var1:object_class:private] => 20
1083             [private_var2:object_class:private] => 21
1084             [protected_var1:protected] => string_1
1085             [protected_var2:protected] => string_2
1086             [public_var2] => 11
1087         )
1088
1089     [no_member_class_object] => no_member_class Object
1090         (
1091         )
1092
1093     [class_object5] => contains_object_class Object
1094  *RECURSION*
1095 )
1096
1097 contains_object_class Object
1098 (
1099     [p] => 30
1100     [class_object1] => object_class Object
1101         (
1102             [value] => 50
1103             [public_var1] => 10
1104             [private_var1:object_class:private] => 20
1105             [private_var2:object_class:private] => 21
1106             [protected_var1:protected] => string_1
1107             [protected_var2:protected] => string_2
1108             [public_var2] => 11
1109         )
1110
1111     [class_object2] => object_class Object
1112         (
1113             [value] => 50
1114             [public_var1] => 10
1115             [private_var1:object_class:private] => 20
1116             [private_var2:object_class:private] => 21
1117             [protected_var1:protected] => string_1
1118             [protected_var2:protected] => string_2
1119             [public_var2] => 11
1120         )
1121
1122     [class_object3:contains_object_class:private] => object_class Object
1123         (
1124             [value] => 50
1125             [public_var1] => 10
1126             [private_var1:object_class:private] => 20
1127             [private_var2:object_class:private] => 21
1128             [protected_var1:protected] => string_1
1129             [protected_var2:protected] => string_2
1130             [public_var2] => 11
1131         )
1132
1133     [class_object4:protected] => object_class Object
1134         (
1135             [value] => 50
1136             [public_var1] => 10
1137             [private_var1:object_class:private] => 20
1138             [private_var2:object_class:private] => 21
1139             [protected_var1:protected] => string_1
1140             [protected_var2:protected] => string_2
1141             [public_var2] => 11
1142         )
1143
1144     [no_member_class_object] => no_member_class Object
1145         (
1146         )
1147
1148     [class_object5] => contains_object_class Object
1149  *RECURSION*
1150 )
1151
1152 -- Iteration 4 --
1153 contains_object_class Object
1154 (
1155     [p] => 30
1156     [class_object1] => object_class Object
1157         (
1158             [value] => 50
1159             [public_var1] => 10
1160             [private_var1:object_class:private] => 20
1161             [private_var2:object_class:private] => 21
1162             [protected_var1:protected] => string_1
1163             [protected_var2:protected] => string_2
1164             [public_var2] => 11
1165         )
1166
1167     [class_object2] => object_class Object
1168         (
1169             [value] => 50
1170             [public_var1] => 10
1171             [private_var1:object_class:private] => 20
1172             [private_var2:object_class:private] => 21
1173             [protected_var1:protected] => string_1
1174             [protected_var2:protected] => string_2
1175             [public_var2] => 11
1176         )
1177
1178     [class_object3:contains_object_class:private] => object_class Object
1179         (
1180             [value] => 50
1181             [public_var1] => 10
1182             [private_var1:object_class:private] => 20
1183             [private_var2:object_class:private] => 21
1184             [protected_var1:protected] => string_1
1185             [protected_var2:protected] => string_2
1186             [public_var2] => 11
1187         )
1188
1189     [class_object4:protected] => object_class Object
1190         (
1191             [value] => 50
1192             [public_var1] => 10
1193             [private_var1:object_class:private] => 20
1194             [private_var2:object_class:private] => 21
1195             [protected_var1:protected] => string_1
1196             [protected_var2:protected] => string_2
1197             [public_var2] => 11
1198         )
1199
1200     [no_member_class_object] => no_member_class Object
1201         (
1202         )
1203
1204     [class_object5] => contains_object_class Object
1205  *RECURSION*
1206 )
1207
1208 contains_object_class Object
1209 (
1210     [p] => 30
1211     [class_object1] => object_class Object
1212         (
1213             [value] => 50
1214             [public_var1] => 10
1215             [private_var1:object_class:private] => 20
1216             [private_var2:object_class:private] => 21
1217             [protected_var1:protected] => string_1
1218             [protected_var2:protected] => string_2
1219             [public_var2] => 11
1220         )
1221
1222     [class_object2] => object_class Object
1223         (
1224             [value] => 50
1225             [public_var1] => 10
1226             [private_var1:object_class:private] => 20
1227             [private_var2:object_class:private] => 21
1228             [protected_var1:protected] => string_1
1229             [protected_var2:protected] => string_2
1230             [public_var2] => 11
1231         )
1232
1233     [class_object3:contains_object_class:private] => object_class Object
1234         (
1235             [value] => 50
1236             [public_var1] => 10
1237             [private_var1:object_class:private] => 20
1238             [private_var2:object_class:private] => 21
1239             [protected_var1:protected] => string_1
1240             [protected_var2:protected] => string_2
1241             [public_var2] => 11
1242         )
1243
1244     [class_object4:protected] => object_class Object
1245         (
1246             [value] => 50
1247             [public_var1] => 10
1248             [private_var1:object_class:private] => 20
1249             [private_var2:object_class:private] => 21
1250             [protected_var1:protected] => string_1
1251             [protected_var2:protected] => string_2
1252             [public_var2] => 11
1253         )
1254
1255     [no_member_class_object] => no_member_class Object
1256         (
1257         )
1258
1259     [class_object5] => contains_object_class Object
1260  *RECURSION*
1261 )
1262
1263 contains_object_class Object
1264 (
1265     [p] => 30
1266     [class_object1] => object_class Object
1267         (
1268             [value] => 50
1269             [public_var1] => 10
1270             [private_var1:object_class:private] => 20
1271             [private_var2:object_class:private] => 21
1272             [protected_var1:protected] => string_1
1273             [protected_var2:protected] => string_2
1274             [public_var2] => 11
1275         )
1276
1277     [class_object2] => object_class Object
1278         (
1279             [value] => 50
1280             [public_var1] => 10
1281             [private_var1:object_class:private] => 20
1282             [private_var2:object_class:private] => 21
1283             [protected_var1:protected] => string_1
1284             [protected_var2:protected] => string_2
1285             [public_var2] => 11
1286         )
1287
1288     [class_object3:contains_object_class:private] => object_class Object
1289         (
1290             [value] => 50
1291             [public_var1] => 10
1292             [private_var1:object_class:private] => 20
1293             [private_var2:object_class:private] => 21
1294             [protected_var1:protected] => string_1
1295             [protected_var2:protected] => string_2
1296             [public_var2] => 11
1297         )
1298
1299     [class_object4:protected] => object_class Object
1300         (
1301             [value] => 50
1302             [public_var1] => 10
1303             [private_var1:object_class:private] => 20
1304             [private_var2:object_class:private] => 21
1305             [protected_var1:protected] => string_1
1306             [protected_var2:protected] => string_2
1307             [public_var2] => 11
1308         )
1309
1310     [no_member_class_object] => no_member_class Object
1311         (
1312         )
1313
1314     [class_object5] => contains_object_class Object
1315  *RECURSION*
1316 )
1317
1318 -- Iteration 5 --
1319 object_class Object
1320 (
1321     [value] => 50
1322     [public_var1] => 10
1323     [private_var1:object_class:private] => 20
1324     [private_var2:object_class:private] => 21
1325     [protected_var1:protected] => string_1
1326     [protected_var2:protected] => string_2
1327     [public_var2] => 11
1328 )
1329
1330 object_class Object
1331 (
1332     [value] => 50
1333     [public_var1] => 10
1334     [private_var1:object_class:private] => 20
1335     [private_var2:object_class:private] => 21
1336     [protected_var1:protected] => string_1
1337     [protected_var2:protected] => string_2
1338     [public_var2] => 11
1339 )
1340
1341 object_class Object
1342 (
1343     [value] => 50
1344     [public_var1] => 10
1345     [private_var1:object_class:private] => 20
1346     [private_var2:object_class:private] => 21
1347     [protected_var1:protected] => string_1
1348     [protected_var2:protected] => string_2
1349     [public_var2] => 11
1350 )
1351
1352 -- Iteration 6 --
1353 object_class Object
1354 (
1355     [value] => 50
1356     [public_var1] => 10
1357     [private_var1:object_class:private] => 20
1358     [private_var2:object_class:private] => 21
1359     [protected_var1:protected] => string_1
1360     [protected_var2:protected] => string_2
1361     [public_var2] => 11
1362 )
1363
1364 object_class Object
1365 (
1366     [value] => 50
1367     [public_var1] => 10
1368     [private_var1:object_class:private] => 20
1369     [private_var2:object_class:private] => 21
1370     [protected_var1:protected] => string_1
1371     [protected_var2:protected] => string_2
1372     [public_var2] => 11
1373 )
1374
1375 object_class Object
1376 (
1377     [value] => 50
1378     [public_var1] => 10
1379     [private_var1:object_class:private] => 20
1380     [private_var2:object_class:private] => 21
1381     [protected_var1:protected] => string_1
1382     [protected_var2:protected] => string_2
1383     [public_var2] => 11
1384 )
1385
1386 -- Iteration 7 --
1387 no_member_class Object
1388 (
1389 )
1390
1391 no_member_class Object
1392 (
1393 )
1394
1395 no_member_class Object
1396 (
1397 )
1398
1399 -- Iteration 8 --
1400 object_class Object
1401 (
1402     [value] => 50
1403     [public_var1] => 10
1404     [private_var1:object_class:private] => 20
1405     [private_var2:object_class:private] => 21
1406     [protected_var1:protected] => string_1
1407     [protected_var2:protected] => string_2
1408     [public_var2] => 11
1409 )
1410
1411 object_class Object
1412 (
1413     [value] => 50
1414     [public_var1] => 10
1415     [private_var1:object_class:private] => 20
1416     [private_var2:object_class:private] => 21
1417     [protected_var1:protected] => string_1
1418     [protected_var2:protected] => string_2
1419     [public_var2] => 11
1420 )
1421
1422 object_class Object
1423 (
1424     [value] => 50
1425     [public_var1] => 10
1426     [private_var1:object_class:private] => 20
1427     [private_var2:object_class:private] => 21
1428     [protected_var1:protected] => string_1
1429     [protected_var2:protected] => string_2
1430     [public_var2] => 11
1431 )
1432
1433 -- Iteration 9 --
1434
1435
1436
1437 ** Testing print_r() on objects having circular reference **
1438 object_class Object
1439 (
1440     [value] => 50
1441     [public_var1] => 10
1442     [private_var1:object_class:private] => 20
1443     [private_var2:object_class:private] => 21
1444     [protected_var1:protected] => string_1
1445     [protected_var2:protected] => string_2
1446     [public_var2] => 11
1447     [obj] => object_class Object
1448         (
1449             [value] => 50
1450             [public_var1] => 10
1451             [private_var1:object_class:private] => 20
1452             [private_var2:object_class:private] => 21
1453             [protected_var1:protected] => string_1
1454             [protected_var2:protected] => string_2
1455             [public_var2] => 11
1456             [obj] => object_class Object
1457  *RECURSION*
1458         )
1459
1460 )
1461
1462 *** Testing print_r() on resources ***
1463
1464 -- Iteration 1 --
1465 Resource id #5
1466 Resource id #5
1467 Resource id #5
1468 -- Iteration 2 --
1469 Resource id #6
1470 Resource id #6
1471 Resource id #6
1472 *** Testing print_r() on different combinations of scalar
1473     and non-scalar variables ***
1474
1475 -- Iteration 1 --
1476 Array
1477 (
1478     [0] => 123
1479     [1] => -1.2345
1480     [2] => a
1481 )
1482
1483 Array
1484 (
1485     [0] => 123
1486     [1] => -1.2345
1487     [2] => a
1488 )
1489
1490 Array
1491 (
1492     [0] => 123
1493     [1] => -1.2345
1494     [2] => a
1495 )
1496
1497 -- Iteration 2 --
1498 Array
1499 (
1500     [0] => d
1501     [1] => Array
1502         (
1503             [0] => 1
1504             [1] => 3
1505             [2] => 5
1506         )
1507
1508     [2] => 1
1509     [3] => 
1510 )
1511
1512 Array
1513 (
1514     [0] => d
1515     [1] => Array
1516         (
1517             [0] => 1
1518             [1] => 3
1519             [2] => 5
1520         )
1521
1522     [2] => 1
1523     [3] => 
1524 )
1525
1526 Array
1527 (
1528     [0] => d
1529     [1] => Array
1530         (
1531             [0] => 1
1532             [1] => 3
1533             [2] => 5
1534         )
1535
1536     [2] => 1
1537     [3] => 
1538 )
1539
1540 -- Iteration 3 --
1541 Array
1542 (
1543     [0] => no_member_class Object
1544         (
1545         )
1546
1547     [1] => Array
1548         (
1549         )
1550
1551     [2] => 
1552     [3] => 0
1553 )
1554
1555 Array
1556 (
1557     [0] => no_member_class Object
1558         (
1559         )
1560
1561     [1] => Array
1562         (
1563         )
1564
1565     [2] => 
1566     [3] => 0
1567 )
1568
1569 Array
1570 (
1571     [0] => no_member_class Object
1572         (
1573         )
1574
1575     [1] => Array
1576         (
1577         )
1578
1579     [2] => 
1580     [3] => 0
1581 )
1582
1583 -- Iteration 4 --
1584 Array
1585 (
1586     [0] => -0
1587     [1] => Where am I?
1588     [2] => Array
1589         (
1590             [0] => 7
1591             [1] => 8
1592             [2] => 9
1593         )
1594
1595     [3] => 1
1596     [4] => A
1597     [5] => 987654321
1598 )
1599
1600 Array
1601 (
1602     [0] => -0
1603     [1] => Where am I?
1604     [2] => Array
1605         (
1606             [0] => 7
1607             [1] => 8
1608             [2] => 9
1609         )
1610
1611     [3] => 1
1612     [4] => A
1613     [5] => 987654321
1614 )
1615
1616 Array
1617 (
1618     [0] => -0
1619     [1] => Where am I?
1620     [2] => Array
1621         (
1622             [0] => 7
1623             [1] => 8
1624             [2] => 9
1625         )
1626
1627     [3] => 1
1628     [4] => A
1629     [5] => 987654321
1630 )
1631
1632 -- Iteration 5 --
1633 Array
1634 (
1635     [0] => 
1636     [1] => 20000000000
1637     [2] => 79.1
1638     [3] => 4.599998
1639 )
1640
1641 Array
1642 (
1643     [0] => 
1644     [1] => 20000000000
1645     [2] => 79.1
1646     [3] => 4.599998
1647 )
1648
1649 Array
1650 (
1651     [0] => 
1652     [1] => 20000000000
1653     [2] => 79.1
1654     [3] => 4.599998
1655 )
1656
1657 -- Iteration 6 --
1658 Array
1659 (
1660     [0] => array(1,2,3,4)1.0000002TRUE
1661     [1] => 
1662     [2] => 4611333
1663     [3] => /00\7
1664 )
1665
1666 Array
1667 (
1668     [0] => array(1,2,3,4)1.0000002TRUE
1669     [1] => 
1670     [2] => 4611333
1671     [3] => /00\7
1672 )
1673
1674 Array
1675 (
1676     [0] => array(1,2,3,4)1.0000002TRUE
1677     [1] => 
1678     [2] => 4611333
1679     [3] => /00\7
1680 )
1681
1682 *** Testing print_r() on miscellaneous input arguments ***
1683
1684 -- Iteration 1 --
1685
1686
1687
1688 -- Iteration 2 --
1689
1690
1691
1692 -- Iteration 3 --
1693
1694
1695
1696 -- Iteration 4 --
1697
1698
1699 Done