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