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
11<?php
12/* Prototype: bool print_r ( mixed $expression [, bool $return] );
13   Description: Prints human-readable information about a variable
14*/
15
16/* Prototype: void check_printr( $variables )
17   Description: use print_r() to print variables */
18function check_printr( $variables ) {
19  $counter = 1;
20  foreach( $variables as $variable ) {
21    echo "\n-- Iteration $counter --\n";
22    //default = false, prints output to screen
23    print_r($variable);
24    //$return=TRUE, print_r() will return its output, instead of printing it
25    $ret_string = print_r($variable, true); //$ret_string captures the output
26    echo "\n$ret_string\n";
27    //$return=false, print_r() prints the output; default behavior
28    print_r($variable, false);
29    $counter++;
30  }
31}
32
33echo "\n*** Testing print_r() on integer variables ***\n";
34$integers = array (
35  0,  // zero as argument
36  000000123,  //octal value of 83
37  123000000,
38  -00000123,  //octal value of 83
39  -12300000,
40  range(1,10),  // positive values
41  range(-1,-10),  // negative values
42  +2147483647,  // max positive integer
43  +2147483648,  // max positive integer + 1
44  -2147483648,  // min range of integer
45  -2147483647,  // min range of integer + 1
46  0x7FFFFFFF,  // max positive hexadecimal integer
47  -0x80000000,  // min range of hexadecimal integer
48  017777777777,  // max posotive octal integer
49  -020000000000  // min range of octal integer
50);
51/* calling check_printr() to display contents of integer variables
52   using print_r() */
53check_printr($integers);
54
55echo "\n*** Testing print_r() on float variables ***\n";
56$floats = array (
57  -0.0,
58  +0.0,
59  1.234,
60  -1.234,
61  -2.000000,
62  000002.00,
63  -.5,
64  .567,
65  -.6700000e-3,
66  -.6700000E+3,
67  .6700000E+3,
68  .6700000e+3,
69  -4.10003e-3,
70  -4.10003E+3,
71  4.100003e-3,
72  4.100003E+3,
73  1e5,
74  -1e5,
75  1e-5,
76  -1e-5,
77  1e+5,
78  -1e+5,
79  1E5,
80  -1E5,
81  1E+5,
82  -1E+5,
83  1E-5,
84  -1E-5,
85  -0x80000001,  // float value, beyond max negative int
86  0x80000001,  // float value, beyond max positive int
87  020000000001,  // float value, beyond max positive int
88  -020000000001  // float value, beyond max negative int
89);
90/* calling check_printr() to display contents of float variables
91   using print_r() */
92check_printr($floats);
93
94echo "\n*** Testing print_r() on string variables ***\n";
95$strings = array (
96  "",
97  '',
98  " ",
99  ' ',
100  "0",
101  "\0",
102  '\0',
103  "\t",
104  '\t',
105  "PHP",
106  'PHP',
107  "abcd\x0n1234\x0005678\x0000efgh\xijkl",  // strings with hexadecimal NULL
108  "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz",  // strings with octal NULL
109  "1234\t\n5678\n\t9100\rabcda"  // strings with escape characters
110);
111/* calling check_printr() to display contents of strings using print_r() */
112check_printr($strings);
113
114echo "\n*** Testing print_r() on boolean variables ***\n";
115$booleans = array (
116  TRUE,
117  FALSE,
118  true,
119  false
120);
121/* calling check_printr() to display boolean variables using print_r() */
122check_printr($booleans);
123var_dump( reset($booleans) );
124echo "\n";
125var_dump( current($booleans) );
126
127echo "\n*** Testing print_r() on array variables ***\n";
128$arrays = array (
129  array(),
130  array(NULL),
131  array(null),
132  array(true),
133  array(""),
134  array(''),
135  array(array(), array()),
136  array(array(1, 2), array('a', 'b')),
137  array(1 => 'One'),
138  array("test" => "is_array"),
139  array(0),
140  array(-1),
141  array(10.5, 5.6),
142  array("string", "test"),
143  array('string', 'test'),
144);
145/* calling check_printr() to display contents of $arrays */
146check_printr($arrays);
147
148echo "\n*** Testing print_r() on object variables ***\n";
149class object_class
150{
151  var       $value;
152  public    $public_var1 = 10;
153  private   $private_var1 = 20;
154  private   $private_var2;
155  protected $protected_var1 = "string_1";
156  protected $protected_var2;
157
158  function object_class ( ) {
159    $this->value = 50;
160    $this->public_var2 = 11;
161    $this->private_var2 = 21;
162    $this->protected_var2 = "string_2";
163  }
164
165  public function foo1() {
166    echo "foo1() is called\n";
167  }
168  protected function foo2() {
169    echo "foo2() is called\n";
170  }
171  private function foo3() {
172    echo "foo3() is called\n";
173  }
174}
175/* class with no member */
176class no_member_class {
177 // no members
178}
179
180/* class with member as object of other class */
181class contains_object_class
182{
183   var       $p = 30;
184   var       $class_object1;
185   public    $class_object2;
186   private   $class_object3;
187   protected $class_object4;
188   var       $no_member_class_object;
189
190   public function func() {
191     echo "func() is called \n";
192   }
193
194   function contains_object_class () {
195     $this->class_object1 = new object_class();
196     $this->class_object2 = new object_class();
197     $this->class_object3 = $this->class_object1;
198     $this->class_object4 = $this->class_object2;
199     $this->no_member_class_object = new no_member_class();
200     $this->class_object5 = $this;   //recursive reference
201   }
202}
203
204/* objects of different classes */
205$obj = new contains_object_class;
206$temp_class_obj = new object_class();
207
208/* object which is unset */
209$unset_obj = new object_class();
210unset($unset_obj);
211
212$objects = array (
213  new object_class,
214  new no_member_class,
215  new contains_object_class,
216  $obj,
217  $obj->class_object1,
218  $obj->class_object2,
219  $obj->no_member_class_object,
220  $temp_class_obj,
221  @$unset_obj
222);
223/* calling check_printr() to display contents of the objects using print_r() */
224check_printr($objects);
225
226echo "\n** Testing print_r() on objects having circular reference **\n";
227$recursion_obj1 = new object_class();
228$recursion_obj2 = new object_class();
229$recursion_obj1->obj = &$recursion_obj2;  //circular reference
230$recursion_obj2->obj = &$recursion_obj1;  //circular reference
231print_r($recursion_obj2);
232
233echo "\n*** Testing print_r() on resources ***\n";
234/* file type resource */
235$file_handle = fopen(__FILE__, "r");
236
237/* directory type resource */
238$dir_handle = opendir( dirname(__FILE__) );
239
240$resources = array (
241  $file_handle,
242  $dir_handle
243);
244/* calling check_printr() to display the resource content type
245   using print_r() */
246check_printr($resources);
247
248echo "\n*** Testing print_r() on different combinations of scalar
249            and non-scalar variables ***\n";
250/* a variable which is unset */
251$unset_var = 10.5;
252unset($unset_var);
253
254/* unset file type resource */
255unset($file_handle);
256
257$variations = array (
258  array( 123, -1.2345, "a" ),
259  array( "d", array(1, 3, 5), true, null),
260  array( new no_member_class, array(), false, 0 ),
261  array( -0.00, "Where am I?", array(7,8,9), TRUE, 'A', 987654321 ),
262  array( @$unset_var, 2.E+10, 100-20.9, 000004.599998 ),  //unusual data
263  array( "array(1,2,3,4)1.0000002TRUE", @$file_handle, 111333.00+45e5, '/00\7')
264);
265/* calling check_printr() to display combinations of scalar and
266   non-scalar variables using print_r() */
267check_printr($variations);
268
269echo "\n*** Testing print_r() on miscelleneous input arguments ***\n";
270$misc_values = array (
271  @$unset_var,
272  NULL,  // NULL argument
273  @$undef_variable,  //undefined variable
274  null
275);
276/* calling check_printr() to display miscelleneous data using print_r() */
277check_printr($misc_values);
278
279/* checking print_r() on functions */
280echo "\n*** Testing print_r() on anonymous functions ***\n";
281$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
282echo "New anonymous function: $newfunc\n";
283print_r( $newfunc(2, 3) );
284/* creating anonymous function dynamically */
285print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
286
287echo "\n\n*** Testing error conditions ***\n";
288//passing zero argument
289var_dump( print_r() );
290
291//passing more than required no. of arguments
292var_dump( print_r(123, true, "abc") );
293
294// check when second arg is given other than boolean TRUE
295var_dump( print_r ($value, "string") );
296
297/* closing resource handle used */
298closedir($dir_handle);
299
300echo "Done\n";
301?>
302--EXPECTF--
303*** Testing print_r() on integer variables ***
304
305-- Iteration 1 --
3060
3070
3080
309-- Iteration 2 --
31083
31183
31283
313-- Iteration 3 --
314123000000
315123000000
316123000000
317-- Iteration 4 --
318-83
319-83
320-83
321-- Iteration 5 --
322-12300000
323-12300000
324-12300000
325-- Iteration 6 --
326Array
327(
328    [0] => 1
329    [1] => 2
330    [2] => 3
331    [3] => 4
332    [4] => 5
333    [5] => 6
334    [6] => 7
335    [7] => 8
336    [8] => 9
337    [9] => 10
338)
339
340Array
341(
342    [0] => 1
343    [1] => 2
344    [2] => 3
345    [3] => 4
346    [4] => 5
347    [5] => 6
348    [6] => 7
349    [7] => 8
350    [8] => 9
351    [9] => 10
352)
353
354Array
355(
356    [0] => 1
357    [1] => 2
358    [2] => 3
359    [3] => 4
360    [4] => 5
361    [5] => 6
362    [6] => 7
363    [7] => 8
364    [8] => 9
365    [9] => 10
366)
367
368-- Iteration 7 --
369Array
370(
371    [0] => -1
372    [1] => -2
373    [2] => -3
374    [3] => -4
375    [4] => -5
376    [5] => -6
377    [6] => -7
378    [7] => -8
379    [8] => -9
380    [9] => -10
381)
382
383Array
384(
385    [0] => -1
386    [1] => -2
387    [2] => -3
388    [3] => -4
389    [4] => -5
390    [5] => -6
391    [6] => -7
392    [7] => -8
393    [8] => -9
394    [9] => -10
395)
396
397Array
398(
399    [0] => -1
400    [1] => -2
401    [2] => -3
402    [3] => -4
403    [4] => -5
404    [5] => -6
405    [6] => -7
406    [7] => -8
407    [8] => -9
408    [9] => -10
409)
410
411-- Iteration 8 --
4122147483647
4132147483647
4142147483647
415-- Iteration 9 --
4162147483648
4172147483648
4182147483648
419-- Iteration 10 --
420-2147483648
421-2147483648
422-2147483648
423-- Iteration 11 --
424-2147483647
425-2147483647
426-2147483647
427-- Iteration 12 --
4282147483647
4292147483647
4302147483647
431-- Iteration 13 --
432-2147483648
433-2147483648
434-2147483648
435-- Iteration 14 --
4362147483647
4372147483647
4382147483647
439-- Iteration 15 --
440-2147483648
441-2147483648
442-2147483648
443*** Testing print_r() on float variables ***
444
445-- Iteration 1 --
4460
4470
4480
449-- Iteration 2 --
4500
4510
4520
453-- Iteration 3 --
4541.234
4551.234
4561.234
457-- Iteration 4 --
458-1.234
459-1.234
460-1.234
461-- Iteration 5 --
462-2
463-2
464-2
465-- Iteration 6 --
4662
4672
4682
469-- Iteration 7 --
470-0.5
471-0.5
472-0.5
473-- Iteration 8 --
4740.567
4750.567
4760.567
477-- Iteration 9 --
478-0.00067
479-0.00067
480-0.00067
481-- Iteration 10 --
482-670
483-670
484-670
485-- Iteration 11 --
486670
487670
488670
489-- Iteration 12 --
490670
491670
492670
493-- Iteration 13 --
494-0.00410003
495-0.00410003
496-0.00410003
497-- Iteration 14 --
498-4100.03
499-4100.03
500-4100.03
501-- Iteration 15 --
5020.004100003
5030.004100003
5040.004100003
505-- Iteration 16 --
5064100.003
5074100.003
5084100.003
509-- Iteration 17 --
510100000
511100000
512100000
513-- Iteration 18 --
514-100000
515-100000
516-100000
517-- Iteration 19 --
5181.0E-5
5191.0E-5
5201.0E-5
521-- Iteration 20 --
522-1.0E-5
523-1.0E-5
524-1.0E-5
525-- Iteration 21 --
526100000
527100000
528100000
529-- Iteration 22 --
530-100000
531-100000
532-100000
533-- Iteration 23 --
534100000
535100000
536100000
537-- Iteration 24 --
538-100000
539-100000
540-100000
541-- Iteration 25 --
542100000
543100000
544100000
545-- Iteration 26 --
546-100000
547-100000
548-100000
549-- Iteration 27 --
5501.0E-5
5511.0E-5
5521.0E-5
553-- Iteration 28 --
554-1.0E-5
555-1.0E-5
556-1.0E-5
557-- Iteration 29 --
558-2147483649
559-2147483649
560-2147483649
561-- Iteration 30 --
5622147483649
5632147483649
5642147483649
565-- Iteration 31 --
5662147483649
5672147483649
5682147483649
569-- Iteration 32 --
570-2147483649
571-2147483649
572-2147483649
573*** Testing print_r() on string variables ***
574
575-- Iteration 1 --
576
577
578
579-- Iteration 2 --
580
581
582
583-- Iteration 3 --
584
585
586
587-- Iteration 4 --
588
589
590
591-- Iteration 5 --
5920
5930
5940
595-- Iteration 6 --
596597598599-- Iteration 7 --
600\0
601\0
602\0
603-- Iteration 8 --
604
605
606
607-- Iteration 9 --
608\t
609\t
610\t
611-- Iteration 10 --
612PHP
613PHP
614PHP
615-- Iteration 11 --
616PHP
617PHP
618PHP
619-- Iteration 12 --
620abcd�n1234�05678�00efgh\xijkl
621abcd�n1234�05678�00efgh\xijkl
622abcd�n1234�05678�00efgh\xijkl
623-- Iteration 13 --
624abcd�efgh�ijkl�mnop�0qrst�uvwx�0yz
625abcd�efgh�ijkl�mnop�0qrst�uvwx�0yz
626abcd�efgh�ijkl�mnop�0qrst�uvwx�0yz
627-- Iteration 14 --
6281234
6295678
630	9100
630abcda
6311234
6325678
633	9100
633abcda
6341234
6355678
636	9100
636abcda
637*** Testing print_r() on boolean variables ***
638
639-- Iteration 1 --
6401
6411
6421
643-- Iteration 2 --
644
645
646
647-- Iteration 3 --
6481
6491
6501
651-- Iteration 4 --
652
653
654bool(true)
655
656bool(true)
657
658*** Testing print_r() on array variables ***
659
660-- Iteration 1 --
661Array
662(
663)
664
665Array
666(
667)
668
669Array
670(
671)
672
673-- Iteration 2 --
674Array
675(
676    [0] =>
677)
678
679Array
680(
681    [0] =>
682)
683
684Array
685(
686    [0] =>
687)
688
689-- Iteration 3 --
690Array
691(
692    [0] =>
693)
694
695Array
696(
697    [0] =>
698)
699
700Array
701(
702    [0] =>
703)
704
705-- Iteration 4 --
706Array
707(
708    [0] => 1
709)
710
711Array
712(
713    [0] => 1
714)
715
716Array
717(
718    [0] => 1
719)
720
721-- Iteration 5 --
722Array
723(
724    [0] =>
725)
726
727Array
728(
729    [0] =>
730)
731
732Array
733(
734    [0] =>
735)
736
737-- Iteration 6 --
738Array
739(
740    [0] =>
741)
742
743Array
744(
745    [0] =>
746)
747
748Array
749(
750    [0] =>
751)
752
753-- Iteration 7 --
754Array
755(
756    [0] => Array
757        (
758        )
759
760    [1] => Array
761        (
762        )
763
764)
765
766Array
767(
768    [0] => Array
769        (
770        )
771
772    [1] => Array
773        (
774        )
775
776)
777
778Array
779(
780    [0] => Array
781        (
782        )
783
784    [1] => Array
785        (
786        )
787
788)
789
790-- Iteration 8 --
791Array
792(
793    [0] => Array
794        (
795            [0] => 1
796            [1] => 2
797        )
798
799    [1] => Array
800        (
801            [0] => a
802            [1] => b
803        )
804
805)
806
807Array
808(
809    [0] => Array
810        (
811            [0] => 1
812            [1] => 2
813        )
814
815    [1] => Array
816        (
817            [0] => a
818            [1] => b
819        )
820
821)
822
823Array
824(
825    [0] => Array
826        (
827            [0] => 1
828            [1] => 2
829        )
830
831    [1] => Array
832        (
833            [0] => a
834            [1] => b
835        )
836
837)
838
839-- Iteration 9 --
840Array
841(
842    [1] => One
843)
844
845Array
846(
847    [1] => One
848)
849
850Array
851(
852    [1] => One
853)
854
855-- Iteration 10 --
856Array
857(
858    [test] => is_array
859)
860
861Array
862(
863    [test] => is_array
864)
865
866Array
867(
868    [test] => is_array
869)
870
871-- Iteration 11 --
872Array
873(
874    [0] => 0
875)
876
877Array
878(
879    [0] => 0
880)
881
882Array
883(
884    [0] => 0
885)
886
887-- Iteration 12 --
888Array
889(
890    [0] => -1
891)
892
893Array
894(
895    [0] => -1
896)
897
898Array
899(
900    [0] => -1
901)
902
903-- Iteration 13 --
904Array
905(
906    [0] => 10.5
907    [1] => 5.6
908)
909
910Array
911(
912    [0] => 10.5
913    [1] => 5.6
914)
915
916Array
917(
918    [0] => 10.5
919    [1] => 5.6
920)
921
922-- Iteration 14 --
923Array
924(
925    [0] => string
926    [1] => test
927)
928
929Array
930(
931    [0] => string
932    [1] => test
933)
934
935Array
936(
937    [0] => string
938    [1] => test
939)
940
941-- Iteration 15 --
942Array
943(
944    [0] => string
945    [1] => test
946)
947
948Array
949(
950    [0] => string
951    [1] => test
952)
953
954Array
955(
956    [0] => string
957    [1] => test
958)
959
960*** Testing print_r() on object variables ***
961
962-- Iteration 1 --
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
974object_class Object
975(
976    [value] => 50
977    [public_var1] => 10
978    [private_var1:object_class:private] => 20
979    [private_var2:object_class:private] => 21
980    [protected_var1:protected] => string_1
981    [protected_var2:protected] => string_2
982    [public_var2] => 11
983)
984
985object_class Object
986(
987    [value] => 50
988    [public_var1] => 10
989    [private_var1:object_class:private] => 20
990    [private_var2:object_class:private] => 21
991    [protected_var1:protected] => string_1
992    [protected_var2:protected] => string_2
993    [public_var2] => 11
994)
995
996-- Iteration 2 --
997no_member_class Object
998(
999)
1000
1001no_member_class Object
1002(
1003)
1004
1005no_member_class Object
1006(
1007)
1008
1009-- Iteration 3 --
1010contains_object_class Object
1011(
1012    [p] => 30
1013    [class_object1] => 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_object2] => 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    [class_object3:contains_object_class:private] => object_class Object
1036        (
1037            [value] => 50
1038            [public_var1] => 10
1039            [private_var1:object_class:private] => 20
1040            [private_var2:object_class:private] => 21
1041            [protected_var1:protected] => string_1
1042            [protected_var2:protected] => string_2
1043            [public_var2] => 11
1044        )
1045
1046    [class_object4:protected] => 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    [no_member_class_object] => no_member_class Object
1058        (
1059        )
1060
1061    [class_object5] => contains_object_class Object
1062 *RECURSION*
1063)
1064
1065contains_object_class Object
1066(
1067    [p] => 30
1068    [class_object1] => 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_object2] => 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    [class_object3:contains_object_class:private] => object_class Object
1091        (
1092            [value] => 50
1093            [public_var1] => 10
1094            [private_var1:object_class:private] => 20
1095            [private_var2:object_class:private] => 21
1096            [protected_var1:protected] => string_1
1097            [protected_var2:protected] => string_2
1098            [public_var2] => 11
1099        )
1100
1101    [class_object4:protected] => 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    [no_member_class_object] => no_member_class Object
1113        (
1114        )
1115
1116    [class_object5] => contains_object_class Object
1117 *RECURSION*
1118)
1119
1120contains_object_class Object
1121(
1122    [p] => 30
1123    [class_object1] => 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_object2] => 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    [class_object3:contains_object_class:private] => object_class Object
1146        (
1147            [value] => 50
1148            [public_var1] => 10
1149            [private_var1:object_class:private] => 20
1150            [private_var2:object_class:private] => 21
1151            [protected_var1:protected] => string_1
1152            [protected_var2:protected] => string_2
1153            [public_var2] => 11
1154        )
1155
1156    [class_object4:protected] => object_class Object
1157        (
1158            [value] => 50
1159            [public_var1] => 10
1160            [private_var1:object_class:private] => 20
1161            [private_var2:object_class:private] => 21
1162            [protected_var1:protected] => string_1
1163            [protected_var2:protected] => string_2
1164            [public_var2] => 11
1165        )
1166
1167    [no_member_class_object] => no_member_class Object
1168        (
1169        )
1170
1171    [class_object5] => contains_object_class Object
1172 *RECURSION*
1173)
1174
1175-- Iteration 4 --
1176contains_object_class Object
1177(
1178    [p] => 30
1179    [class_object1] => 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_object2] => 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    [class_object3:contains_object_class:private] => object_class Object
1202        (
1203            [value] => 50
1204            [public_var1] => 10
1205            [private_var1:object_class:private] => 20
1206            [private_var2:object_class:private] => 21
1207            [protected_var1:protected] => string_1
1208            [protected_var2:protected] => string_2
1209            [public_var2] => 11
1210        )
1211
1212    [class_object4:protected] => 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    [no_member_class_object] => no_member_class Object
1224        (
1225        )
1226
1227    [class_object5] => contains_object_class Object
1228 *RECURSION*
1229)
1230
1231contains_object_class Object
1232(
1233    [p] => 30
1234    [class_object1] => 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_object2] => 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    [class_object3:contains_object_class:private] => object_class Object
1257        (
1258            [value] => 50
1259            [public_var1] => 10
1260            [private_var1:object_class:private] => 20
1261            [private_var2:object_class:private] => 21
1262            [protected_var1:protected] => string_1
1263            [protected_var2:protected] => string_2
1264            [public_var2] => 11
1265        )
1266
1267    [class_object4:protected] => 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    [no_member_class_object] => no_member_class Object
1279        (
1280        )
1281
1282    [class_object5] => contains_object_class Object
1283 *RECURSION*
1284)
1285
1286contains_object_class Object
1287(
1288    [p] => 30
1289    [class_object1] => 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_object2] => 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    [class_object3:contains_object_class:private] => object_class Object
1312        (
1313            [value] => 50
1314            [public_var1] => 10
1315            [private_var1:object_class:private] => 20
1316            [private_var2:object_class:private] => 21
1317            [protected_var1:protected] => string_1
1318            [protected_var2:protected] => string_2
1319            [public_var2] => 11
1320        )
1321
1322    [class_object4:protected] => object_class Object
1323        (
1324            [value] => 50
1325            [public_var1] => 10
1326            [private_var1:object_class:private] => 20
1327            [private_var2:object_class:private] => 21
1328            [protected_var1:protected] => string_1
1329            [protected_var2:protected] => string_2
1330            [public_var2] => 11
1331        )
1332
1333    [no_member_class_object] => no_member_class Object
1334        (
1335        )
1336
1337    [class_object5] => contains_object_class Object
1338 *RECURSION*
1339)
1340
1341-- Iteration 5 --
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
1353object_class Object
1354(
1355    [value] => 50
1356    [public_var1] => 10
1357    [private_var1:object_class:private] => 20
1358    [private_var2:object_class:private] => 21
1359    [protected_var1:protected] => string_1
1360    [protected_var2:protected] => string_2
1361    [public_var2] => 11
1362)
1363
1364object_class Object
1365(
1366    [value] => 50
1367    [public_var1] => 10
1368    [private_var1:object_class:private] => 20
1369    [private_var2:object_class:private] => 21
1370    [protected_var1:protected] => string_1
1371    [protected_var2:protected] => string_2
1372    [public_var2] => 11
1373)
1374
1375-- Iteration 6 --
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
1387object_class Object
1388(
1389    [value] => 50
1390    [public_var1] => 10
1391    [private_var1:object_class:private] => 20
1392    [private_var2:object_class:private] => 21
1393    [protected_var1:protected] => string_1
1394    [protected_var2:protected] => string_2
1395    [public_var2] => 11
1396)
1397
1398object_class Object
1399(
1400    [value] => 50
1401    [public_var1] => 10
1402    [private_var1:object_class:private] => 20
1403    [private_var2:object_class:private] => 21
1404    [protected_var1:protected] => string_1
1405    [protected_var2:protected] => string_2
1406    [public_var2] => 11
1407)
1408
1409-- Iteration 7 --
1410no_member_class Object
1411(
1412)
1413
1414no_member_class Object
1415(
1416)
1417
1418no_member_class Object
1419(
1420)
1421
1422-- Iteration 8 --
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
1434object_class Object
1435(
1436    [value] => 50
1437    [public_var1] => 10
1438    [private_var1:object_class:private] => 20
1439    [private_var2:object_class:private] => 21
1440    [protected_var1:protected] => string_1
1441    [protected_var2:protected] => string_2
1442    [public_var2] => 11
1443)
1444
1445object_class Object
1446(
1447    [value] => 50
1448    [public_var1] => 10
1449    [private_var1:object_class:private] => 20
1450    [private_var2:object_class:private] => 21
1451    [protected_var1:protected] => string_1
1452    [protected_var2:protected] => string_2
1453    [public_var2] => 11
1454)
1455
1456-- Iteration 9 --
1457
1458
1459
1460** Testing print_r() on objects having circular reference **
1461object_class Object
1462(
1463    [value] => 50
1464    [public_var1] => 10
1465    [private_var1:object_class:private] => 20
1466    [private_var2:object_class:private] => 21
1467    [protected_var1:protected] => string_1
1468    [protected_var2:protected] => string_2
1469    [public_var2] => 11
1470    [obj] => object_class Object
1471        (
1472            [value] => 50
1473            [public_var1] => 10
1474            [private_var1:object_class:private] => 20
1475            [private_var2:object_class:private] => 21
1476            [protected_var1:protected] => string_1
1477            [protected_var2:protected] => string_2
1478            [public_var2] => 11
1479            [obj] => object_class Object
1480 *RECURSION*
1481        )
1482
1483)
1484
1485*** Testing print_r() on resources ***
1486
1487-- Iteration 1 --
1488Resource id #5
1489Resource id #5
1490Resource id #5
1491-- Iteration 2 --
1492Resource id #6
1493Resource id #6
1494Resource id #6
1495*** Testing print_r() on different combinations of scalar
1496            and non-scalar variables ***
1497
1498-- Iteration 1 --
1499Array
1500(
1501    [0] => 123
1502    [1] => -1.2345
1503    [2] => a
1504)
1505
1506Array
1507(
1508    [0] => 123
1509    [1] => -1.2345
1510    [2] => a
1511)
1512
1513Array
1514(
1515    [0] => 123
1516    [1] => -1.2345
1517    [2] => a
1518)
1519
1520-- Iteration 2 --
1521Array
1522(
1523    [0] => d
1524    [1] => Array
1525        (
1526            [0] => 1
1527            [1] => 3
1528            [2] => 5
1529        )
1530
1531    [2] => 1
1532    [3] =>
1533)
1534
1535Array
1536(
1537    [0] => d
1538    [1] => Array
1539        (
1540            [0] => 1
1541            [1] => 3
1542            [2] => 5
1543        )
1544
1545    [2] => 1
1546    [3] =>
1547)
1548
1549Array
1550(
1551    [0] => d
1552    [1] => Array
1553        (
1554            [0] => 1
1555            [1] => 3
1556            [2] => 5
1557        )
1558
1559    [2] => 1
1560    [3] =>
1561)
1562
1563-- Iteration 3 --
1564Array
1565(
1566    [0] => no_member_class Object
1567        (
1568        )
1569
1570    [1] => Array
1571        (
1572        )
1573
1574    [2] =>
1575    [3] => 0
1576)
1577
1578Array
1579(
1580    [0] => no_member_class Object
1581        (
1582        )
1583
1584    [1] => Array
1585        (
1586        )
1587
1588    [2] =>
1589    [3] => 0
1590)
1591
1592Array
1593(
1594    [0] => no_member_class Object
1595        (
1596        )
1597
1598    [1] => Array
1599        (
1600        )
1601
1602    [2] =>
1603    [3] => 0
1604)
1605
1606-- Iteration 4 --
1607Array
1608(
1609    [0] => 0
1610    [1] => Where am I?
1611    [2] => Array
1612        (
1613            [0] => 7
1614            [1] => 8
1615            [2] => 9
1616        )
1617
1618    [3] => 1
1619    [4] => A
1620    [5] => 987654321
1621)
1622
1623Array
1624(
1625    [0] => 0
1626    [1] => Where am I?
1627    [2] => Array
1628        (
1629            [0] => 7
1630            [1] => 8
1631            [2] => 9
1632        )
1633
1634    [3] => 1
1635    [4] => A
1636    [5] => 987654321
1637)
1638
1639Array
1640(
1641    [0] => 0
1642    [1] => Where am I?
1643    [2] => Array
1644        (
1645            [0] => 7
1646            [1] => 8
1647            [2] => 9
1648        )
1649
1650    [3] => 1
1651    [4] => A
1652    [5] => 987654321
1653)
1654
1655-- Iteration 5 --
1656Array
1657(
1658    [0] =>
1659    [1] => 20000000000
1660    [2] => 79.1
1661    [3] => 4.599998
1662)
1663
1664Array
1665(
1666    [0] =>
1667    [1] => 20000000000
1668    [2] => 79.1
1669    [3] => 4.599998
1670)
1671
1672Array
1673(
1674    [0] =>
1675    [1] => 20000000000
1676    [2] => 79.1
1677    [3] => 4.599998
1678)
1679
1680-- Iteration 6 --
1681Array
1682(
1683    [0] => array(1,2,3,4)1.0000002TRUE
1684    [1] =>
1685    [2] => 4611333
1686    [3] => /00\7
1687)
1688
1689Array
1690(
1691    [0] => array(1,2,3,4)1.0000002TRUE
1692    [1] =>
1693    [2] => 4611333
1694    [3] => /00\7
1695)
1696
1697Array
1698(
1699    [0] => array(1,2,3,4)1.0000002TRUE
1700    [1] =>
1701    [2] => 4611333
1702    [3] => /00\7
1703)
1704
1705*** Testing print_r() on miscelleneous input arguments ***
1706
1707-- Iteration 1 --
1708
1709
1710
1711-- Iteration 2 --
1712
1713
1714
1715-- Iteration 3 --
1716
1717
1718
1719-- Iteration 4 --
1720
1721
1722
1723*** Testing print_r() on anonymous functions ***
1724New anonymous function: �lambda_1
17252 * 3 = 6�lambda_2
1726
1727*** Testing error conditions ***
1728
1729Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d
1730bool(false)
1731
1732Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d
1733bool(false)
1734
1735Notice: Undefined variable: value in %s on line %d
1736string(0) ""
1737Done
1738