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