summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/chop_basic.phpt
blob: 7e25ec12e3e1fe3c72e51e90c55397f13947847a (plain)
ofshex dumpascii
0000 2d 2d 54 45 53 54 2d 2d 0a 54 65 73 74 20 63 68 6f 70 28 29 20 66 75 6e 63 74 69 6f 6e 20 3a 20 --TEST--.Test.chop().function.:.
0020 62 61 73 69 63 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79 0a 2d 2d 46 49 4c 45 2d 2d 0a 3c 3f 70 basic.functionality.--FILE--.<?p
0040 68 70 0a 2f 2a 20 50 72 6f 74 6f 74 79 70 65 20 20 3a 20 73 74 72 69 6e 67 20 63 68 6f 70 20 28 hp./*.Prototype..:.string.chop.(
0060 20 73 74 72 69 6e 67 20 24 73 74 72 20 5b 2c 20 73 74 72 69 6e 67 20 24 63 68 61 72 6c 69 73 74 .string.$str.[,.string.$charlist
0080 5d 20 29 0a 20 2a 20 44 65 73 63 72 69 70 74 69 6f 6e 3a 20 53 74 72 69 70 20 77 68 69 74 65 73 ].)..*.Description:.Strip.whites
00a0 70 61 63 65 20 28 6f 72 20 6f 74 68 65 72 20 63 68 61 72 61 63 74 65 72 73 29 20 66 72 6f 6d 20 pace.(or.other.characters).from.
00c0 74 68 65 20 65 6e 64 20 6f 66 20 61 20 73 74 72 69 6e 67 0a 20 2a 20 53 6f 75 72 63 65 20 63 6f the.end.of.a.string..*.Source.co
00e0 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 2a 2f 0a 0a 2f 2a de:.ext/standard/string.c.*/../*
0100 0a 20 2a 20 54 65 73 74 69 6e 67 20 63 68 6f 70 28 29 3a 20 62 61 73 69 63 20 66 75 6e 63 74 69 ..*.Testing.chop():.basic.functi
0120 6f 6e 61 6c 69 74 79 0a 2a 2f 0a 0a 65 63 68 6f 20 22 2a 2a 2a 20 54 65 73 74 69 6e 67 20 63 68 onality.*/..echo."***.Testing.ch
0140 6f 70 28 29 20 3a 20 62 61 73 69 63 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79 20 2a 2a 2a 5c 6e op().:.basic.functionality.***\n
0160 22 3b 0a 0a 2f 2f 20 49 6e 69 74 69 61 6c 69 7a 65 20 61 6c 6c 20 72 65 71 75 69 72 65 64 20 76 ";..//.Initialize.all.required.v
0180 61 72 69 61 62 6c 65 73 0a 24 73 74 72 20 3d 20 22 68 65 6c 6c 6f 20 77 6f 72 6c 64 5c 74 5c 6e ariables.$str.=."hello.world\t\n
01a0 5c 72 5c 30 5c 78 30 42 20 20 22 3b 0a 24 63 68 61 72 6c 69 73 74 20 3d 20 27 64 6c 20 27 3b 0a \r\0\x0B..";.$charlist.=.'dl.';.
01c0 0a 2f 2f 20 43 61 6c 6c 69 6e 67 20 63 68 6f 70 28 29 20 77 69 74 68 20 64 65 66 61 75 6c 74 20 .//.Calling.chop().with.default.
01e0 61 72 67 75 6d 65 6e 74 73 0a 76 61 72 5f 64 75 6d 70 28 20 63 68 6f 70 28 24 73 74 72 29 20 29 arguments.var_dump(.chop($str).)
0200 3b 0a 0a 2f 2f 20 43 61 6c 6c 69 6e 67 20 63 68 6f 70 28 29 20 77 69 74 68 20 61 6c 6c 20 61 72 ;..//.Calling.chop().with.all.ar
0220 67 75 6d 65 6e 74 73 0a 76 61 72 5f 64 75 6d 70 28 20 63 68 6f 70 28 24 73 74 72 2c 20 24 63 68 guments.var_dump(.chop($str,.$ch
0240 61 72 6c 69 73 74 29 20 29 3b 0a 0a 2f 2f 20 43 61 6c 6c 69 6e 67 20 63 68 6f 70 28 29 20 77 69 arlist).);..//.Calling.chop().wi
0260 74 68 20 74 68 65 20 63 68 61 72 6c 69 73 74 20 6e 6f 74 20 70 72 65 73 65 6e 74 20 61 74 20 74 th.the.charlist.not.present.at.t
0280 68 65 20 65 6e 64 20 6f 66 20 69 6e 70 75 74 20 73 74 72 69 6e 67 0a 76 61 72 5f 64 75 6d 70 28 he.end.of.input.string.var_dump(
02a0 20 63 68 6f 70 28 24 73 74 72 2c 20 27 21 27 29 20 29 3b 0a 0a 65 63 68 6f 20 22 44 6f 6e 65 5c .chop($str,.'!').);..echo."Done\
02c0 6e 22 3b 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 63 68 n";.?>.--EXPECT--.***.Testing.ch
02e0 6f 70 28 29 20 3a 20 62 61 73 69 63 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79 20 2a 2a 2a 0a 73 op().:.basic.functionality.***.s
0300 74 72 69 6e 67 28 31 31 29 20 22 68 65 6c 6c 6f 20 77 6f 72 6c 64 22 0a 73 74 72 69 6e 67 28 31 tring(11)."hello.world".string(1
0320 36 29 20 22 68 65 6c 6c 6f 20 77 6f 72 6c 64 09 0a 0d 00 0b 22 0a 73 74 72 69 6e 67 28 31 38 29 6)."hello.world.....".string(18)
0340 20 22 68 65 6c 6c 6f 20 77 6f 72 6c 64 09 0a 0d 00 0b 20 20 22 0a 44 6f 6e 65 0a ."hello.world.......".Done.