summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/strspn_variation9.phpt
blob: 5ec2330e25e96b0a142100268bff421ee513d469 (plain)
ofshex dumpascii
0000 2d 2d 54 45 53 54 2d 2d 0a 54 65 73 74 20 73 74 72 73 70 6e 28 29 20 66 75 6e 63 74 69 6f 6e 20 --TEST--.Test.strspn().function.
0020 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 65 6e 74 20 73 :.usage.variations.-.different.s
0040 74 72 69 6e 67 73 20 77 69 74 68 20 64 65 66 61 75 6c 74 20 73 74 61 72 74 20 61 6e 64 20 6c 65 trings.with.default.start.and.le
0060 6e 20 61 72 67 73 0a 2d 2d 46 49 4c 45 2d 2d 0a 3c 3f 70 68 70 0a 2f 2a 20 50 72 6f 74 6f 74 79 n.args.--FILE--.<?php./*.Prototy
0080 70 65 20 20 3a 20 70 72 6f 74 6f 20 69 6e 74 20 73 74 72 73 70 6e 28 73 74 72 69 6e 67 20 73 74 pe..:.proto.int.strspn(string.st
00a0 72 2c 20 73 74 72 69 6e 67 20 6d 61 73 6b 20 5b 2c 20 69 6e 74 20 73 74 61 72 74 20 5b 2c 20 69 r,.string.mask.[,.int.start.[,.i
00c0 6e 74 20 6c 65 6e 5d 5d 29 0a 20 2a 20 44 65 73 63 72 69 70 74 69 6f 6e 3a 20 46 69 6e 64 73 20 nt.len]])..*.Description:.Finds.
00e0 6c 65 6e 67 74 68 20 6f 66 20 69 6e 69 74 69 61 6c 20 73 65 67 6d 65 6e 74 20 63 6f 6e 73 69 73 length.of.initial.segment.consis
0100 74 69 6e 67 20 65 6e 74 69 72 65 6c 79 20 6f 66 20 63 68 61 72 61 63 74 65 72 73 20 66 6f 75 6e ting.entirely.of.characters.foun
0120 64 20 69 6e 20 6d 61 73 6b 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 49 66 20 73 74 d.in.mask..................If.st
0140 61 72 74 20 6f 72 2f 61 6e 64 20 6c 65 6e 67 74 68 20 69 73 20 70 72 6f 76 69 64 65 64 20 77 6f art.or/and.length.is.provided.wo
0160 72 6b 73 20 6c 69 6b 65 20 73 74 72 73 70 6e 28 73 75 62 73 74 72 28 24 73 2c 24 73 74 61 72 74 rks.like.strspn(substr($s,$start
0180 2c 24 6c 65 6e 29 2c 24 67 6f 6f 64 5f 63 68 61 72 73 29 20 0a 20 2a 20 53 6f 75 72 63 65 20 63 ,$len),$good_chars)...*.Source.c
01a0 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 41 6c ode:.ext/standard/string.c..*.Al
01c0 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 2a 20 ias.to.functions:.none.*/../*.*.
01e0 54 65 73 74 69 6e 67 20 73 74 72 73 70 6e 28 29 20 3a 20 77 69 74 68 20 64 69 66 66 65 72 65 6e Testing.strspn().:.with.differen
0200 74 20 73 74 72 69 6e 67 73 20 61 73 20 73 74 72 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 64 65 t.strings.as.str.argument.and.de
0220 66 61 75 6c 74 20 73 74 61 72 74 20 61 6e 64 20 6c 65 6e 20 61 72 67 73 0a 2a 2f 0a 0a 65 63 68 fault.start.and.len.args.*/..ech
0240 6f 20 22 2a 2a 2a 20 54 65 73 74 69 6e 67 20 73 74 72 73 70 6e 28 29 20 3a 20 77 69 74 68 20 64 o."***.Testing.strspn().:.with.d
0260 69 66 66 65 72 65 6e 74 20 73 74 72 20 61 6e 64 20 64 65 66 61 75 6c 74 20 73 74 61 72 74 20 61 ifferent.str.and.default.start.a
0280 6e 64 20 6c 65 6e 20 61 72 67 73 20 2a 2a 2a 5c 6e 22 3b 0a 0a 2f 2f 20 69 6e 69 74 69 61 6c 69 nd.len.args.***\n";..//.initiali
02a0 6e 67 20 72 65 71 75 69 72 65 64 20 76 61 72 69 61 62 6c 65 73 0a 2f 2f 20 64 65 66 69 6e 69 6e ng.required.variables.//.definin
02c0 67 20 64 69 66 66 65 72 65 6e 74 20 73 74 72 69 6e 67 73 0a 0a 24 73 74 72 69 6e 67 73 20 3d 20 g.different.strings..$strings.=.
02e0 61 72 72 61 79 28 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 22 2c 0a 09 09 array(...................."",...
0300 20 20 20 27 27 2c 0a 09 09 20 20 20 22 5c 6e 22 2c 0a 09 09 20 20 20 27 5c 6e 27 2c 0a 09 09 20 ...'',......"\n",......'\n',....
0320 20 20 22 68 65 6c 6c 6f 5c 74 77 6f 72 6c 64 5c 6e 68 65 6c 6c 6f 5c 6e 77 6f 72 6c 64 5c 6e 22 .."hello\tworld\nhello\nworld\n"
0340 2c 0a 09 09 20 20 20 27 68 65 6c 6c 6f 5c 74 77 6f 72 6c 64 5c 6e 68 65 6c 6c 6f 5c 6e 77 6f 72 ,......'hello\tworld\nhello\nwor
0360 6c 64 5c 6e 27 2c 0a 20 09 09 20 20 20 22 31 32 33 34 68 65 6c 6c 6f 34 35 77 6f 72 6c 64 5c 74 ld\n',......."1234hello45world\t
0380 31 32 33 22 2c 0a 20 09 09 20 20 20 27 31 32 33 34 68 65 6c 6c 6f 34 35 77 6f 72 6c 64 5c 74 31 123",.......'1234hello45world\t1
03a0 32 33 27 2c 0a 09 09 20 20 20 22 68 65 6c 6c 6f 5c 30 77 6f 72 6c 64 5c 30 31 32 22 2c 0a 09 09 23',......"hello\0world\012",...
03c0 20 20 20 27 68 65 6c 6c 6f 5c 30 77 6f 72 6c 64 5c 30 31 32 27 2c 0a 09 09 20 20 20 63 68 72 28 ...'hello\0world\012',......chr(
03e0 30 29 2e 63 68 72 28 30 29 2c 0a 09 09 20 20 20 63 68 72 28 30 29 2e 22 68 65 6c 6c 6f 5c 30 77 0).chr(0),......chr(0)."hello\0w
0400 6f 72 6c 64 22 2e 63 68 72 28 30 29 2c 0a 09 09 20 20 20 63 68 72 28 30 29 2e 27 68 65 6c 6c 6f orld".chr(0),......chr(0).'hello
0420 5c 30 77 6f 72 6c 64 27 2e 63 68 72 28 30 29 2c 0a 09 09 20 20 20 22 68 65 6c 6c 6f 22 2e 63 68 \0world'.chr(0),......"hello".ch
0440 72 28 30 29 2e 22 77 6f 72 6c 64 22 2c 0a 09 09 20 20 20 27 68 65 6c 6c 6f 27 2e 63 68 72 28 30 r(0)."world",......'hello'.chr(0
0460 29 2e 27 77 6f 72 6c 64 27 2c 0a 09 09 20 20 20 22 68 65 6c 6c 6f 5c 30 5c 31 30 30 5c 78 61 61 ).'world',......"hello\0\100\xaa
0480 61 77 6f 72 6c 64 22 2c 0a 09 09 20 20 20 27 68 65 6c 6c 6f 5c 30 5c 31 30 30 5c 78 61 61 61 77 aworld",......'hello\0\100\xaaaw
04a0 6f 72 6c 64 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 29 3b 0a 0a 24 6d 61 orld'....................);..$ma
04c0 73 6b 20 3d 20 22 73 66 74 68 31 32 5c 6e 65 33 34 6c 77 35 36 72 37 38 64 39 30 5c 30 5c 78 61 sk.=."sfth12\ne34lw56r78d90\0\xa
04e0 61 5c 31 30 30 6f 22 3b 0a 0a 0a 2f 2f 20 6c 6f 6f 70 20 74 68 72 6f 75 67 68 20 65 61 63 68 20 a\100o";...//.loop.through.each.
0500 65 6c 65 6d 65 6e 74 20 6f 66 20 74 68 65 20 61 72 72 61 79 20 66 6f 72 20 73 74 72 20 61 72 67 element.of.the.array.for.str.arg
0520 75 6d 65 6e 74 0a 0a 66 6f 72 65 61 63 68 28 24 73 74 72 69 6e 67 73 20 61 73 20 24 73 74 72 29 ument..foreach($strings.as.$str)
0540 20 7b 0a 20 20 20 20 20 20 65 63 68 6f 20 22 5c 6e 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 77 69 .{.......echo."\n--.Iteration.wi
0560 74 68 20 73 74 72 20 76 61 6c 75 65 20 5c 22 24 73 74 72 5c 22 20 2d 2d 5c 6e 22 3b 0a 20 20 20 th.str.value.\"$str\".--\n";....
0580 0a 20 20 20 20 20 20 2f 2f 63 61 6c 6c 69 6e 67 20 73 74 72 73 70 6e 28 29 20 77 69 74 68 20 64 .......//calling.strspn().with.d
05a0 65 66 61 75 6c 74 20 61 72 67 75 6d 65 6e 74 73 0a 20 20 20 20 20 20 76 61 72 5f 64 75 6d 70 28 efault.arguments.......var_dump(
05c0 20 73 74 72 73 70 6e 28 24 73 74 72 2c 24 6d 61 73 6b 29 20 29 3b 0a 7d 3b 0a 0a 65 63 68 6f 20 .strspn($str,$mask).);.};..echo.
05e0 22 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 "Done".?>.--EXPECT--.***.Testing
0600 20 73 74 72 73 70 6e 28 29 20 3a 20 77 69 74 68 20 64 69 66 66 65 72 65 6e 74 20 73 74 72 20 61 .strspn().:.with.different.str.a
0620 6e 64 20 64 65 66 61 75 6c 74 20 73 74 61 72 74 20 61 6e 64 20 6c 65 6e 20 61 72 67 73 20 2a 2a nd.default.start.and.len.args.**
0640 2a 0a 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 77 69 74 68 20 73 74 72 20 76 61 6c 75 65 20 22 *..--.Iteration.with.str.value."
0660 22 20 2d 2d 0a 69 6e 74 28 30 29 0a 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 77 69 74 68 20 73 ".--.int(0)..--.Iteration.with.s
0680 74 72 20 76 61 6c 75 65 20 22 22 20 2d 2d 0a 69 6e 74 28 30 29 0a 0a 2d 2d 20 49 74 65 72 61 74 tr.value."".--.int(0)..--.Iterat
06a0 69 6f 6e 20 77 69 74 68 20 73 74 72 20 76 61 6c 75 65 20 22 0a 22 20 2d 2d 0a 69 6e 74 28 31 29 ion.with.str.value.".".--.int(1)
06c0 0a 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 77 69 74 68 20 73 74 72 20 76 61 6c 75 65 20 22 5c ..--.Iteration.with.str.value."\
06e0 6e 22 20 2d 2d 0a 69 6e 74 28 30 29 0a 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 77 69 74 68 20 n".--.int(0)..--.Iteration.with.
0700 73 74 72 20 76 61 6c 75 65 20 22 68 65 6c 6c 6f 09 77 6f 72 6c 64 0a 68 65 6c 6c 6f 0a 77 6f 72 str.value."hello.world.hello.wor
0720 6c 64 0a 22 20 2d 2d 0a 69 6e 74 28 35 29 0a 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 77 69 74 ld.".--.int(5)..--.Iteration.wit
0740 68 20 73 74 72 20 76 61 6c 75 65 20 22 68 65 6c 6c 6f 5c 74 77 6f 72 6c 64 5c 6e 68 65 6c 6c 6f h.str.value."hello\tworld\nhello
0760 5c 6e 77 6f 72 6c 64 5c 6e 22 20 2d 2d 0a 69 6e 74 28 35 29 0a 0a 2d 2d 20 49 74 65 72 61 74 69 \nworld\n".--.int(5)..--.Iterati
0780 6f 6e 20 77 69 74 68 20 73 74 72 20 76 61 6c 75 65 20 22 31 32 33 34 68 65 6c 6c 6f 34 35 77 6f on.with.str.value."1234hello45wo
07a0 72 6c 64 09 31 32 33 22 20 2d 2d 0a 69 6e 74 28 31 36 29 0a 0a 2d 2d 20 49 74 65 72 61 74 69 6f rld.123".--.int(16)..--.Iteratio
07c0 6e 20 77 69 74 68 20 73 74 72 20 76 61 6c 75 65 20 22 31 32 33 34 68 65 6c 6c 6f 34 35 77 6f 72 n.with.str.value."1234hello45wor
07e0 6c 64 5c 74 31 32 33 22 20 2d 2d 0a 69 6e 74 28 31 36 29 0a 0a 2d 2d 20 49 74 65 72 61 74 69 6f ld\t123".--.int(16)..--.Iteratio
0800 6e 20 77 69 74 68 20 73 74 72 20 76 61 6c 75 65 20 22 68 65 6c 6c 6f 00 77 6f 72 6c 64 0a 22 20 n.with.str.value."hello.world.".
0820 2d 2d 0a 69 6e 74 28 31 32 29 0a 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 77 69 74 68 20 73 74 --.int(12)..--.Iteration.with.st
0840 72 20 76 61 6c 75 65 20 22 68 65 6c 6c 6f 5c 30 77 6f 72 6c 64 5c 30 31 32 22 20 2d 2d 0a 69 6e r.value."hello\0world\012".--.in
0860 74 28 35 29 0a 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 77 69 74 68 20 73 74 72 20 76 61 6c 75 t(5)..--.Iteration.with.str.valu
0880 65 20 22 00 00 22 20 2d 2d 0a 69 6e 74 28 32 29 0a 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 77 e."..".--.int(2)..--.Iteration.w
08a0 69 74 68 20 73 74 72 20 76 61 6c 75 65 20 22 00 68 65 6c 6c 6f 00 77 6f 72 6c 64 00 22 20 2d 2d ith.str.value.".hello.world.".--
08c0 0a 69 6e 74 28 31 33 29 0a 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 77 69 74 68 20 73 74 72 20 .int(13)..--.Iteration.with.str.
08e0 76 61 6c 75 65 20 22 00 68 65 6c 6c 6f 5c 30 77 6f 72 6c 64 00 22 20 2d 2d 0a 69 6e 74 28 36 29 value.".hello\0world.".--.int(6)
0900 0a 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 77 69 74 68 20 73 74 72 20 76 61 6c 75 65 20 22 68 ..--.Iteration.with.str.value."h
0920 65 6c 6c 6f 00 77 6f 72 6c 64 22 20 2d 2d 0a 69 6e 74 28 31 31 29 0a 0a 2d 2d 20 49 74 65 72 61 ello.world".--.int(11)..--.Itera
0940 74 69 6f 6e 20 77 69 74 68 20 73 74 72 20 76 61 6c 75 65 20 22 68 65 6c 6c 6f 00 77 6f 72 6c 64 tion.with.str.value."hello.world
0960 22 20 2d 2d 0a 69 6e 74 28 31 31 29 0a 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 77 69 74 68 20 ".--.int(11)..--.Iteration.with.
0980 73 74 72 20 76 61 6c 75 65 20 22 68 65 6c 6c 6f 00 40 aa 61 77 6f 72 6c 64 22 20 2d 2d 0a 69 6e str.value."hello.@.aworld".--.in
09a0 74 28 38 29 0a 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 77 69 74 68 20 73 74 72 20 76 61 6c 75 t(8)..--.Iteration.with.str.valu
09c0 65 20 22 68 65 6c 6c 6f 5c 30 5c 31 30 30 5c 78 61 61 61 77 6f 72 6c 64 22 20 2d 2d 0a 69 6e 74 e."hello\0\100\xaaaworld".--.int
09e0 28 35 29 0a 44 6f 6e 65 0a (5).Done.