summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/array_walk_rec_objects.phpt
blob: e1c5dd6100b5691f7d6149c86efcaf063ba52209 (plain)
ofshex dumpascii
0000 2d 2d 54 45 53 54 2d 2d 0a 61 72 72 61 79 5f 77 61 6c 6b 5f 72 65 63 75 72 73 69 76 65 28 29 20 --TEST--.array_walk_recursive().
0020 61 6e 64 20 6f 62 6a 65 63 74 73 0a 2d 2d 46 49 4c 45 2d 2d 0a 3c 3f 70 68 70 0a 0a 66 75 6e 63 and.objects.--FILE--.<?php..func
0040 74 69 6f 6e 20 77 61 6c 6b 28 24 6b 65 79 2c 20 24 76 61 6c 75 65 29 20 7b 20 0a 09 76 61 72 5f tion.walk($key,.$value).{...var_
0060 64 75 6d 70 28 24 76 61 6c 75 65 2c 20 24 6b 65 79 29 3b 20 0a 7d 0a 0a 63 6c 61 73 73 20 74 65 dump($value,.$key);..}..class.te
0080 73 74 20 7b 0a 09 70 72 69 76 61 74 65 20 24 76 61 72 5f 70 72 69 20 3d 20 22 74 65 73 74 5f 70 st.{..private.$var_pri.=."test_p
00a0 72 69 76 61 74 65 22 3b 0a 09 70 72 6f 74 65 63 74 65 64 20 24 76 61 72 5f 70 72 6f 20 3d 20 22 rivate";..protected.$var_pro.=."
00c0 74 65 73 74 5f 70 72 6f 74 65 63 74 65 64 22 3b 0a 09 70 75 62 6c 69 63 20 24 76 61 72 5f 70 75 test_protected";..public.$var_pu
00e0 62 20 3d 20 22 74 65 73 74 5f 70 75 62 6c 69 63 22 3b 0a 7d 0a 0a 24 73 74 64 63 6c 61 73 73 20 b.=."test_public";.}..$stdclass.
0100 3d 20 6e 65 77 20 73 74 64 63 6c 61 73 73 3b 0a 24 73 74 64 63 6c 61 73 73 2d 3e 66 6f 6f 20 3d =.new.stdclass;.$stdclass->foo.=
0120 20 22 66 6f 6f 22 3b 0a 24 73 74 64 63 6c 61 73 73 2d 3e 62 61 72 20 3d 20 22 62 61 72 22 3b 0a ."foo";.$stdclass->bar.=."bar";.
0140 61 72 72 61 79 5f 77 61 6c 6b 5f 72 65 63 75 72 73 69 76 65 28 24 73 74 64 63 6c 61 73 73 2c 20 array_walk_recursive($stdclass,.
0160 22 77 61 6c 6b 22 29 3b 0a 0a 24 74 20 3d 20 6e 65 77 20 74 65 73 74 3b 0a 61 72 72 61 79 5f 77 "walk");..$t.=.new.test;.array_w
0180 61 6c 6b 5f 72 65 63 75 72 73 69 76 65 28 24 74 2c 20 22 77 61 6c 6b 22 29 3b 0a 0a 24 76 61 72 alk_recursive($t,."walk");..$var
01a0 20 3d 20 61 72 72 61 79 28 29 3b 0a 61 72 72 61 79 5f 77 61 6c 6b 5f 72 65 63 75 72 73 69 76 65 .=.array();.array_walk_recursive
01c0 28 24 76 61 72 2c 20 22 77 61 6c 6b 22 29 3b 0a 24 76 61 72 20 3d 20 22 22 3b 0a 61 72 72 61 79 ($var,."walk");.$var.=."";.array
01e0 5f 77 61 6c 6b 5f 72 65 63 75 72 73 69 76 65 28 24 76 61 72 2c 20 22 77 61 6c 6b 22 29 3b 0a 0a _walk_recursive($var,."walk");..
0200 65 63 68 6f 20 22 44 6f 6e 65 5c 6e 22 3b 0a 3f 3e 0a 2d 2d 45 58 50 45 43 54 46 2d 2d 09 0a 73 echo."Done\n";.?>.--EXPECTF--..s
0220 74 72 69 6e 67 28 33 29 20 22 66 6f 6f 22 0a 73 74 72 69 6e 67 28 33 29 20 22 66 6f 6f 22 0a 73 tring(3)."foo".string(3)."foo".s
0240 74 72 69 6e 67 28 33 29 20 22 62 61 72 22 0a 73 74 72 69 6e 67 28 33 29 20 22 62 61 72 22 0a 73 tring(3)."bar".string(3)."bar".s
0260 74 72 69 6e 67 28 31 33 29 20 22 00 74 65 73 74 00 76 61 72 5f 70 72 69 22 0a 73 74 72 69 6e 67 tring(13).".test.var_pri".string
0280 28 31 32 29 20 22 74 65 73 74 5f 70 72 69 76 61 74 65 22 0a 73 74 72 69 6e 67 28 31 30 29 20 22 (12)."test_private".string(10)."
02a0 00 2a 00 76 61 72 5f 70 72 6f 22 0a 73 74 72 69 6e 67 28 31 34 29 20 22 74 65 73 74 5f 70 72 6f .*.var_pro".string(14)."test_pro
02c0 74 65 63 74 65 64 22 0a 73 74 72 69 6e 67 28 37 29 20 22 76 61 72 5f 70 75 62 22 0a 73 74 72 69 tected".string(7)."var_pub".stri
02e0 6e 67 28 31 31 29 20 22 74 65 73 74 5f 70 75 62 6c 69 63 22 0a 0a 57 61 72 6e 69 6e 67 3a 20 61 ng(11)."test_public"..Warning:.a
0300 72 72 61 79 5f 77 61 6c 6b 5f 72 65 63 75 72 73 69 76 65 28 29 3a 20 54 68 65 20 61 72 67 75 6d rray_walk_recursive():.The.argum
0320 65 6e 74 20 73 68 6f 75 6c 64 20 62 65 20 61 6e 20 61 72 72 61 79 20 69 6e 20 25 73 20 6f 6e 20 ent.should.be.an.array.in.%s.on.
0340 6c 69 6e 65 20 25 64 0a 44 6f 6e 65 0a line.%d.Done.