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