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