summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/chunk_split_variation9.phpt
blob: 36bb26b4bca561256c35f6fc9ae1c52937d16e08 (plain)
ofshex dumpascii
0000 2d 2d 54 45 53 54 2d 2d 0a 54 65 73 74 20 63 68 75 6e 6b 5f 73 70 6c 69 74 28 29 20 66 75 6e 63 --TEST--.Test.chunk_split().func
0020 74 69 6f 6e 20 3a 20 75 73 61 67 65 20 76 61 72 69 61 74 69 6f 6e 73 20 2d 20 64 69 66 66 65 72 tion.:.usage.variations.-.differ
0040 65 6e 74 20 64 6f 75 62 6c 65 20 71 75 6f 74 65 64 20 73 74 72 69 6e 67 73 20 66 6f 72 20 27 65 ent.double.quoted.strings.for.'e
0060 6e 64 69 6e 67 27 20 61 72 67 75 6d 65 6e 74 0a 2d 2d 46 49 4c 45 2d 2d 0a 3c 3f 70 68 70 0a 2f nding'.argument.--FILE--.<?php./
0080 2a 20 50 72 6f 74 6f 74 79 70 65 20 20 3a 20 73 74 72 69 6e 67 20 63 68 75 6e 6b 5f 73 70 6c 69 *.Prototype..:.string.chunk_spli
00a0 74 28 73 74 72 69 6e 67 20 24 73 74 72 20 5b 2c 20 69 6e 74 20 24 63 68 75 6e 6b 6c 65 6e 20 5b t(string.$str.[,.int.$chunklen.[
00c0 2c 20 73 74 72 69 6e 67 20 24 65 6e 64 69 6e 67 5d 5d 29 0a 20 2a 20 44 65 73 63 72 69 70 74 69 ,.string.$ending]])..*.Descripti
00e0 6f 6e 3a 20 52 65 74 75 72 6e 73 20 73 70 6c 69 74 20 6c 69 6e 65 0a 20 2a 20 53 6f 75 72 63 65 on:.Returns.split.line..*.Source
0100 20 63 6f 64 65 3a 20 65 78 74 2f 73 74 61 6e 64 61 72 64 2f 73 74 72 69 6e 67 2e 63 0a 20 2a 20 .code:.ext/standard/string.c..*.
0120 41 6c 69 61 73 20 74 6f 20 66 75 6e 63 74 69 6f 6e 73 3a 20 6e 6f 6e 65 0a 2a 2f 0a 0a 2f 2a 0a Alias.to.functions:.none.*/../*.
0140 2a 20 70 61 73 73 69 6e 67 20 64 69 66 66 65 72 65 6e 74 20 64 6f 75 62 6c 65 20 71 75 6f 74 65 *.passing.different.double.quote
0160 64 20 73 74 72 69 6e 67 73 20 66 6f 72 20 27 65 6e 64 69 6e 67 27 20 61 72 67 75 6d 65 6e 74 20 d.strings.for.'ending'.argument.
0180 74 6f 20 63 68 75 6e 6b 5f 73 70 6c 69 74 28 29 0a 2a 20 68 65 72 65 20 27 63 68 75 6e 6b 6c 65 to.chunk_split().*.here.'chunkle
01a0 6e 27 20 69 73 20 73 65 74 20 74 6f 20 36 2e 35 0a 2a 2f 0a 0a 65 63 68 6f 20 22 2a 2a 2a 20 54 n'.is.set.to.6.5.*/..echo."***.T
01c0 65 73 74 69 6e 67 20 63 68 75 6e 6b 5f 73 70 6c 69 74 28 29 20 3a 20 64 69 66 66 65 72 65 6e 74 esting.chunk_split().:.different
01e0 20 73 74 72 69 6e 67 73 20 66 6f 72 20 27 65 6e 64 69 6e 67 27 20 2a 2a 2a 5c 6e 22 3b 0a 0a 2f .strings.for.'ending'.***\n";../
0200 2f 49 6e 69 74 69 61 6c 69 7a 69 6e 67 20 76 61 72 69 61 62 6c 65 73 0a 24 73 74 72 20 3d 20 22 /Initializing.variables.$str.=."
0220 54 68 69 73 20 69 73 20 74 6f 20 74 65 73 74 20 63 68 75 6e 6b 5f 73 70 6c 69 74 28 29 20 77 69 This.is.to.test.chunk_split().wi
0240 74 68 20 76 61 72 69 6f 75 73 20 65 6e 64 69 6e 67 20 73 74 72 69 6e 67 22 3b 0a 24 63 68 75 6e th.various.ending.string";.$chun
0260 6b 6c 65 6e 20 3d 20 36 2e 35 3b 0a 0a 2f 2f 64 69 66 66 65 72 65 6e 74 20 76 61 6c 75 65 73 20 klen.=.6.5;..//different.values.
0280 66 6f 72 20 27 65 6e 64 69 6e 67 27 20 61 72 67 75 6d 65 6e 74 0a 24 76 61 6c 75 65 73 20 3d 20 for.'ending'.argument.$values.=.
02a0 61 72 72 61 79 20 28 0a 20 20 22 22 2c 20 20 2f 2f 65 6d 70 74 79 0a 20 20 22 20 22 2c 20 20 2f array.(..."",..//empty...".",../
02c0 2f 73 70 61 63 65 0a 20 20 22 61 22 2c 20 20 2f 2f 53 69 6e 67 6c 65 20 63 68 61 72 0a 20 20 22 /space..."a",..//Single.char..."
02e0 45 4e 44 49 4e 47 22 2c 20 20 2f 2f 72 65 67 75 6c 61 72 20 73 74 72 69 6e 67 0a 20 20 22 40 23 ENDING",..//regular.string..."@#
0300 24 25 5e 22 2c 20 20 2f 2f 53 70 65 63 69 61 6c 20 63 68 61 72 73 0a 0a 20 20 2f 2f 20 77 68 69 $%^",..//Special.chars....//.whi
0320 74 65 20 73 70 61 63 65 20 63 68 61 72 73 0a 20 20 22 5c 74 22 2c 0a 20 20 22 5c 6e 22 2c 0a 20 te.space.chars..."\t",..."\n",..
0340 20 22 5c 72 22 2c 0a 20 20 22 5c 72 5c 6e 22 2c 0a 0a 20 20 22 5c 30 22 2c 20 20 2f 2f 4e 75 6c ."\r",..."\r\n",...."\0",..//Nul
0360 6c 20 63 68 61 72 0a 20 20 22 31 32 33 22 2c 20 20 2f 2f 4e 75 6d 65 72 69 63 0a 20 20 22 28 4d l.char..."123",..//Numeric..."(M
0380 53 47 29 22 2c 20 20 2f 2f 57 69 74 68 20 28 20 61 6e 64 20 29 0a 20 20 22 29 65 6e 64 69 6e 67 SG)",..//With.(.and.)...")ending
03a0 20 73 74 72 69 6e 67 28 22 2c 20 20 2f 2f 73 65 6e 74 65 6e 63 65 20 61 73 20 65 6e 64 69 6e 67 .string(",..//sentence.as.ending
03c0 20 73 74 72 69 6e 67 0a 20 20 22 29 6e 75 6d 62 65 72 73 20 31 32 33 34 28 22 2c 0a 20 20 22 29 .string...")numbers.1234(",...")
03e0 73 70 65 63 69 40 21 20 63 68 40 72 24 28 22 0a 29 3b 0a 0a 2f 2f 6c 6f 6f 70 20 74 68 72 6f 75 speci@!.ch@r$(".);..//loop.throu
0400 67 68 20 65 6c 65 6d 65 6e 74 20 6f 66 20 76 61 6c 75 65 73 20 66 6f 72 20 27 65 6e 64 69 6e 67 gh.element.of.values.for.'ending
0420 27 0a 66 6f 72 28 24 63 6f 75 6e 74 20 3d 20 30 3b 20 24 63 6f 75 6e 74 20 3c 20 63 6f 75 6e 74 '.for($count.=.0;.$count.<.count
0440 28 24 76 61 6c 75 65 73 29 3b 20 24 63 6f 75 6e 74 2b 2b 29 20 7b 0a 20 20 65 63 68 6f 20 22 2d ($values);.$count++).{...echo."-
0460 2d 20 49 74 65 72 61 74 69 6f 6e 20 24 63 6f 75 6e 74 20 2d 2d 5c 6e 22 3b 0a 20 20 76 61 72 5f -.Iteration.$count.--\n";...var_
0480 64 75 6d 70 28 20 63 68 75 6e 6b 5f 73 70 6c 69 74 28 24 73 74 72 2c 20 24 63 68 75 6e 6b 6c 65 dump(.chunk_split($str,.$chunkle
04a0 6e 2c 20 24 76 61 6c 75 65 73 5b 24 63 6f 75 6e 74 5d 29 20 29 3b 0a 7d 0a 0a 65 63 68 6f 20 22 n,.$values[$count]).);.}..echo."
04c0 44 6f 6e 65 22 0a 3f 3e 0a 2d 2d 45 58 50 45 43 54 2d 2d 0a 2a 2a 2a 20 54 65 73 74 69 6e 67 20 Done".?>.--EXPECT--.***.Testing.
04e0 63 68 75 6e 6b 5f 73 70 6c 69 74 28 29 20 3a 20 64 69 66 66 65 72 65 6e 74 20 73 74 72 69 6e 67 chunk_split().:.different.string
0500 73 20 66 6f 72 20 27 65 6e 64 69 6e 67 27 20 2a 2a 2a 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 s.for.'ending'.***.--.Iteration.
0520 30 20 2d 2d 0a 73 74 72 69 6e 67 28 35 36 29 20 22 54 68 69 73 20 69 73 20 74 6f 20 74 65 73 74 0.--.string(56)."This.is.to.test
0540 20 63 68 75 6e 6b 5f 73 70 6c 69 74 28 29 20 77 69 74 68 20 76 61 72 69 6f 75 73 20 65 6e 64 69 .chunk_split().with.various.endi
0560 6e 67 20 73 74 72 69 6e 67 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 31 20 2d 2d 0a 73 74 72 ng.string".--.Iteration.1.--.str
0580 69 6e 67 28 36 36 29 20 22 54 68 69 73 20 69 20 73 20 74 6f 20 74 20 65 73 74 20 63 68 20 75 6e ing(66)."This.i.s.to.t.est.ch.un
05a0 6b 5f 73 70 20 6c 69 74 28 29 20 20 77 69 74 68 20 76 20 61 72 69 6f 75 73 20 20 65 6e 64 69 6e k_sp.lit()..with.v.arious..endin
05c0 20 67 20 73 74 72 69 20 6e 67 20 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 32 20 2d 2d 0a 73 .g.stri.ng.".--.Iteration.2.--.s
05e0 74 72 69 6e 67 28 36 36 29 20 22 54 68 69 73 20 69 61 73 20 74 6f 20 74 61 65 73 74 20 63 68 61 tring(66)."This.ias.to.taest.cha
0600 75 6e 6b 5f 73 70 61 6c 69 74 28 29 20 61 77 69 74 68 20 76 61 61 72 69 6f 75 73 61 20 65 6e 64 unk_spalit().awith.vaariousa.end
0620 69 6e 61 67 20 73 74 72 69 61 6e 67 61 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 33 20 2d 2d inag.strianga".--.Iteration.3.--
0640 0a 73 74 72 69 6e 67 28 31 31 36 29 20 22 54 68 69 73 20 69 45 4e 44 49 4e 47 73 20 74 6f 20 74 .string(116)."This.iENDINGs.to.t
0660 45 4e 44 49 4e 47 65 73 74 20 63 68 45 4e 44 49 4e 47 75 6e 6b 5f 73 70 45 4e 44 49 4e 47 6c 69 ENDINGest.chENDINGunk_spENDINGli
0680 74 28 29 20 45 4e 44 49 4e 47 77 69 74 68 20 76 45 4e 44 49 4e 47 61 72 69 6f 75 73 45 4e 44 49 t().ENDINGwith.vENDINGariousENDI
06a0 4e 47 20 65 6e 64 69 6e 45 4e 44 49 4e 47 67 20 73 74 72 69 45 4e 44 49 4e 47 6e 67 45 4e 44 49 NG.endinENDINGg.striENDINGngENDI
06c0 4e 47 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 34 20 2d 2d 0a 73 74 72 69 6e 67 28 31 30 36 NG".--.Iteration.4.--.string(106
06e0 29 20 22 54 68 69 73 20 69 40 23 24 25 5e 73 20 74 6f 20 74 40 23 24 25 5e 65 73 74 20 63 68 40 )."This.i@#$%^s.to.t@#$%^est.ch@
0700 23 24 25 5e 75 6e 6b 5f 73 70 40 23 24 25 5e 6c 69 74 28 29 20 40 23 24 25 5e 77 69 74 68 20 76 #$%^unk_sp@#$%^lit().@#$%^with.v
0720 40 23 24 25 5e 61 72 69 6f 75 73 40 23 24 25 5e 20 65 6e 64 69 6e 40 23 24 25 5e 67 20 73 74 72 @#$%^arious@#$%^.endin@#$%^g.str
0740 69 40 23 24 25 5e 6e 67 40 23 24 25 5e 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 35 20 2d 2d i@#$%^ng@#$%^".--.Iteration.5.--
0760 0a 73 74 72 69 6e 67 28 36 36 29 20 22 54 68 69 73 20 69 09 73 20 74 6f 20 74 09 65 73 74 20 63 .string(66)."This.i.s.to.t.est.c
0780 68 09 75 6e 6b 5f 73 70 09 6c 69 74 28 29 20 09 77 69 74 68 20 76 09 61 72 69 6f 75 73 09 20 65 h.unk_sp.lit()..with.v.arious..e
07a0 6e 64 69 6e 09 67 20 73 74 72 69 09 6e 67 09 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 36 20 ndin.g.stri.ng.".--.Iteration.6.
07c0 2d 2d 0a 73 74 72 69 6e 67 28 36 36 29 20 22 54 68 69 73 20 69 0a 73 20 74 6f 20 74 0a 65 73 74 --.string(66)."This.i.s.to.t.est
07e0 20 63 68 0a 75 6e 6b 5f 73 70 0a 6c 69 74 28 29 20 0a 77 69 74 68 20 76 0a 61 72 69 6f 75 73 0a .ch.unk_sp.lit()..with.v.arious.
0800 20 65 6e 64 69 6e 0a 67 20 73 74 72 69 0a 6e 67 0a 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 .endin.g.stri.ng.".--.Iteration.
0820 37 20 2d 2d 0a 73 74 72 69 6e 67 28 36 36 29 20 22 54 68 69 73 20 69 0d 73 20 74 6f 20 74 0d 65 7.--.string(66)."This.i.s.to.t.e
0840 73 74 20 63 68 0d 75 6e 6b 5f 73 70 0d 6c 69 74 28 29 20 0d 77 69 74 68 20 76 0d 61 72 69 6f 75 st.ch.unk_sp.lit()..with.v.ariou
0860 73 0d 20 65 6e 64 69 6e 0d 67 20 73 74 72 69 0d 6e 67 0d 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f s..endin.g.stri.ng.".--.Iteratio
0880 6e 20 38 20 2d 2d 0a 73 74 72 69 6e 67 28 37 36 29 20 22 54 68 69 73 20 69 0a 73 20 74 6f 20 74 n.8.--.string(76)."This.i.s.to.t
08a0 0a 65 73 74 20 63 68 0a 75 6e 6b 5f 73 70 0a 6c 69 74 28 29 20 0a 77 69 74 68 20 76 0a 61 72 69 .est.ch.unk_sp.lit()..with.v.ari
08c0 6f 75 73 0a 20 65 6e 64 69 6e 0a 67 20 73 74 72 69 0a 6e 67 0a 22 0a 2d 2d 20 49 74 65 72 61 74 ous..endin.g.stri.ng.".--.Iterat
08e0 69 6f 6e 20 39 20 2d 2d 0a 73 74 72 69 6e 67 28 36 36 29 20 22 54 68 69 73 20 69 00 73 20 74 6f ion.9.--.string(66)."This.i.s.to
0900 20 74 00 65 73 74 20 63 68 00 75 6e 6b 5f 73 70 00 6c 69 74 28 29 20 00 77 69 74 68 20 76 00 61 .t.est.ch.unk_sp.lit()..with.v.a
0920 72 69 6f 75 73 00 20 65 6e 64 69 6e 00 67 20 73 74 72 69 00 6e 67 00 22 0a 2d 2d 20 49 74 65 72 rious..endin.g.stri.ng.".--.Iter
0940 61 74 69 6f 6e 20 31 30 20 2d 2d 0a 73 74 72 69 6e 67 28 38 36 29 20 22 54 68 69 73 20 69 31 32 ation.10.--.string(86)."This.i12
0960 33 73 20 74 6f 20 74 31 32 33 65 73 74 20 63 68 31 32 33 75 6e 6b 5f 73 70 31 32 33 6c 69 74 28 3s.to.t123est.ch123unk_sp123lit(
0980 29 20 31 32 33 77 69 74 68 20 76 31 32 33 61 72 69 6f 75 73 31 32 33 20 65 6e 64 69 6e 31 32 33 ).123with.v123arious123.endin123
09a0 67 20 73 74 72 69 31 32 33 6e 67 31 32 33 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 31 31 20 g.stri123ng123".--.Iteration.11.
09c0 2d 2d 0a 73 74 72 69 6e 67 28 31 30 36 29 20 22 54 68 69 73 20 69 28 4d 53 47 29 73 20 74 6f 20 --.string(106)."This.i(MSG)s.to.
09e0 74 28 4d 53 47 29 65 73 74 20 63 68 28 4d 53 47 29 75 6e 6b 5f 73 70 28 4d 53 47 29 6c 69 74 28 t(MSG)est.ch(MSG)unk_sp(MSG)lit(
0a00 29 20 28 4d 53 47 29 77 69 74 68 20 76 28 4d 53 47 29 61 72 69 6f 75 73 28 4d 53 47 29 20 65 6e ).(MSG)with.v(MSG)arious(MSG).en
0a20 64 69 6e 28 4d 53 47 29 67 20 73 74 72 69 28 4d 53 47 29 6e 67 28 4d 53 47 29 22 0a 2d 2d 20 49 din(MSG)g.stri(MSG)ng(MSG)".--.I
0a40 74 65 72 61 74 69 6f 6e 20 31 32 20 2d 2d 0a 73 74 72 69 6e 67 28 32 30 36 29 20 22 54 68 69 73 teration.12.--.string(206)."This
0a60 20 69 29 65 6e 64 69 6e 67 20 73 74 72 69 6e 67 28 73 20 74 6f 20 74 29 65 6e 64 69 6e 67 20 73 .i)ending.string(s.to.t)ending.s
0a80 74 72 69 6e 67 28 65 73 74 20 63 68 29 65 6e 64 69 6e 67 20 73 74 72 69 6e 67 28 75 6e 6b 5f 73 tring(est.ch)ending.string(unk_s
0aa0 70 29 65 6e 64 69 6e 67 20 73 74 72 69 6e 67 28 6c 69 74 28 29 20 29 65 6e 64 69 6e 67 20 73 74 p)ending.string(lit().)ending.st
0ac0 72 69 6e 67 28 77 69 74 68 20 76 29 65 6e 64 69 6e 67 20 73 74 72 69 6e 67 28 61 72 69 6f 75 73 ring(with.v)ending.string(arious
0ae0 29 65 6e 64 69 6e 67 20 73 74 72 69 6e 67 28 20 65 6e 64 69 6e 29 65 6e 64 69 6e 67 20 73 74 72 )ending.string(.endin)ending.str
0b00 69 6e 67 28 67 20 73 74 72 69 29 65 6e 64 69 6e 67 20 73 74 72 69 6e 67 28 6e 67 29 65 6e 64 69 ing(g.stri)ending.string(ng)endi
0b20 6e 67 20 73 74 72 69 6e 67 28 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 31 33 20 2d 2d 0a 73 ng.string(".--.Iteration.13.--.s
0b40 74 72 69 6e 67 28 31 39 36 29 20 22 54 68 69 73 20 69 29 6e 75 6d 62 65 72 73 20 31 32 33 34 28 tring(196)."This.i)numbers.1234(
0b60 73 20 74 6f 20 74 29 6e 75 6d 62 65 72 73 20 31 32 33 34 28 65 73 74 20 63 68 29 6e 75 6d 62 65 s.to.t)numbers.1234(est.ch)numbe
0b80 72 73 20 31 32 33 34 28 75 6e 6b 5f 73 70 29 6e 75 6d 62 65 72 73 20 31 32 33 34 28 6c 69 74 28 rs.1234(unk_sp)numbers.1234(lit(
0ba0 29 20 29 6e 75 6d 62 65 72 73 20 31 32 33 34 28 77 69 74 68 20 76 29 6e 75 6d 62 65 72 73 20 31 ).)numbers.1234(with.v)numbers.1
0bc0 32 33 34 28 61 72 69 6f 75 73 29 6e 75 6d 62 65 72 73 20 31 32 33 34 28 20 65 6e 64 69 6e 29 6e 234(arious)numbers.1234(.endin)n
0be0 75 6d 62 65 72 73 20 31 32 33 34 28 67 20 73 74 72 69 29 6e 75 6d 62 65 72 73 20 31 32 33 34 28 umbers.1234(g.stri)numbers.1234(
0c00 6e 67 29 6e 75 6d 62 65 72 73 20 31 32 33 34 28 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 31 ng)numbers.1234(".--.Iteration.1
0c20 34 20 2d 2d 0a 73 74 72 69 6e 67 28 32 30 36 29 20 22 54 68 69 73 20 69 29 73 70 65 63 69 40 21 4.--.string(206)."This.i)speci@!
0c40 20 63 68 40 72 24 28 73 20 74 6f 20 74 29 73 70 65 63 69 40 21 20 63 68 40 72 24 28 65 73 74 20 .ch@r$(s.to.t)speci@!.ch@r$(est.
0c60 63 68 29 73 70 65 63 69 40 21 20 63 68 40 72 24 28 75 6e 6b 5f 73 70 29 73 70 65 63 69 40 21 20 ch)speci@!.ch@r$(unk_sp)speci@!.
0c80 63 68 40 72 24 28 6c 69 74 28 29 20 29 73 70 65 63 69 40 21 20 63 68 40 72 24 28 77 69 74 68 20 ch@r$(lit().)speci@!.ch@r$(with.
0ca0 76 29 73 70 65 63 69 40 21 20 63 68 40 72 24 28 61 72 69 6f 75 73 29 73 70 65 63 69 40 21 20 63 v)speci@!.ch@r$(arious)speci@!.c
0cc0 68 40 72 24 28 20 65 6e 64 69 6e 29 73 70 65 63 69 40 21 20 63 68 40 72 24 28 67 20 73 74 72 69 h@r$(.endin)speci@!.ch@r$(g.stri
0ce0 29 73 70 65 63 69 40 21 20 63 68 40 72 24 28 6e 67 29 73 70 65 63 69 40 21 20 63 68 40 72 24 28 )speci@!.ch@r$(ng)speci@!.ch@r$(
0d00 22 0a 44 6f 6e 65 0a ".Done.