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