summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/strcspn_variation5.phpt
blob: dc237b4b4138c2da21db14446457884472defa26 (plain)
ofshex dumpascii
0000 2d 2d 54 45 53 54 2d 2d 0a 54 65 73 74 20 73 74 72 63 73 70 6e 28 29 20 66 75 6e 63 74 69 6f 6e --TEST--.Test.strcspn().function
0020 20 3a 20 75 73 61 67 65 20 76 61 72 69 61 74 69 6f 6e 73 20 2d 20 77 69 74 68 20 68 65 72 65 64 .:.usage.variations.-.with.hered
0040 6f 63 20 73 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 oc.strings.with.default.start.an
0060 64 20 6c 65 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 d.len.args.--FILE--.<?php./*.Pro
0080 74 6f 74 79 70 65 20 20 3a 20 70 72 6f 74 6f 20 69 6e 74 20 73 74 72 63 73 70 6e 28 73 74 72 69 totype..:.proto.int.strcspn(stri
00a0 6e 67 20 73 74 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 ng.str,.string.mask.[,.int.start
00c0 20 5b 2c 20 69 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 .[,.int.len]])..*.Description:.F
00e0 69 6e 64 73 20 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 inds.length.of.initial.segment.c
0100 6f 6e 73 69 73 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 onsisting.entirely.of.characters
0120 20 6e 6f 74 20 66 6f 75 6e 64 20 69 6e 20 6d 61 73 6b 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 .not.found.in.mask..............
0140 20 20 20 20 49 66 20 73 74 61 72 74 20 6f 72 2f 61 6e 64 20 6c 65 6e 67 74 68 20 69 73 20 70 72 ....If.start.or/and.length.is.pr
0160 6f 76 69 64 65 64 20 77 6f 72 6b 73 20 6c 69 6b 65 20 73 74 72 63 73 70 6e 28 73 75 62 73 74 72 ovided.works.like.strcspn(substr
0180 28 24 73 2c 24 73 74 61 72 74 2c 24 6c 65 6e 29 2c 24 62 61 64 5f 63 68 61 72 73 29 0a 20 2a 20 ($s,$start,$len),$bad_chars)..*.
01a0 53 6f 75 72 63 65 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 Source.code:.ext/standard/string
01c0 2e 63 0a 20 2a 20 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 .c..*.Alias.to.functions:.none.*
01e0 2f 0a 0a 2f 2a 0a 2a 20 54 65 73 74 69 6e 67 20 73 74 72 63 73 70 6e 28 29 20 3a 20 77 69 74 68 /../*.*.Testing.strcspn().:.with
0200 20 64 69 66 66 65 72 65 6e 74 20 68 65 72 65 64 6f 63 20 73 74 72 69 6e 67 73 20 61 73 20 73 74 .different.heredoc.strings.as.st
0220 72 20 61 72 67 75 6d 65 6e 74 0a 2a 2f 0a 0a 65 63 68 6f 20 22 2a 2a 2a 20 54 65 73 74 69 6e 67 r.argument.*/..echo."***.Testing
0240 20 73 74 72 63 73 70 6e 28 29 20 3a 20 77 69 74 68 20 68 65 72 65 64 6f 63 20 73 74 72 69 6e 67 .strcspn().:.with.heredoc.string
0260 73 20 2a 2a 2a 5c 6e 22 3b 0a 0a 2f 2f 20 69 6e 69 74 69 61 6c 69 6e 67 20 72 65 71 75 69 72 65 s.***\n";..//.initialing.require
0280 64 20 76 61 72 69 61 62 6c 65 73 0a 2f 2f 20 64 65 66 69 6e 69 6e 67 20 64 69 66 66 65 72 65 6e d.variables.//.defining.differen
02a0 74 20 68 65 72 65 64 6f 63 20 73 74 72 69 6e 67 73 0a 24 65 6d 70 74 79 5f 68 65 72 65 64 6f 63 t.heredoc.strings.$empty_heredoc
02c0 20 3d 20 3c 3c 3c 45 4f 54 0a 45 4f 54 3b 0a 0a 24 68 65 72 65 64 6f 63 5f 77 69 74 68 5f 6e 65 .=.<<<EOT.EOT;..$heredoc_with_ne
02e0 77 6c 69 6e 65 20 3d 20 3c 3c 3c 45 4f 54 0a 5c 6e 0a 0a 45 4f 54 3b 0a 0a 24 68 65 72 65 64 6f wline.=.<<<EOT.\n..EOT;..$heredo
0300 63 5f 77 69 74 68 5f 63 68 61 72 61 63 74 65 72 73 20 3d 20 3c 3c 3c 45 4f 54 0a 66 69 72 73 74 c_with_characters.=.<<<EOT.first
0320 20 6c 69 6e 65 20 6f 66 20 68 65 72 65 64 6f 63 20 73 74 72 69 6e 67 0a 73 65 63 6f 6e 64 20 6c .line.of.heredoc.string.second.l
0340 69 6e 65 20 6f 66 20 68 65 72 65 64 6f 63 20 73 74 72 69 6e 67 0a 74 68 69 72 64 20 6c 69 6e 65 ine.of.heredoc.string.third.line
0360 20 6f 66 20 68 65 72 65 64 6f 63 73 74 72 69 6e 67 0a 45 4f 54 3b 0a 0a 24 68 65 72 65 64 6f 63 .of.heredocstring.EOT;..$heredoc
0380 5f 77 69 74 68 5f 6e 65 77 6c 69 6e 65 5f 61 6e 64 5f 74 61 62 73 20 3d 20 3c 3c 3c 45 4f 54 0a _with_newline_and_tabs.=.<<<EOT.
03a0 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 0a 45 4f 54 hello\tworld\nhello\nworld\n.EOT
03c0 3b 0a 0a 24 68 65 72 65 64 6f 63 5f 77 69 74 68 5f 61 6c 70 68 61 6e 75 6d 65 72 69 63 73 20 3d ;..$heredoc_with_alphanumerics.=
03e0 20 3c 3c 3c 45 4f 54 0a 68 65 6c 6c 6f 31 32 33 77 6f 72 6c 64 34 35 36 0a 31 32 33 34 68 65 6c .<<<EOT.hello123world456.1234hel
0400 6c 6f 5c 74 31 32 33 34 0a 45 4f 54 3b 0a 0a 24 68 65 72 65 64 6f 63 5f 77 69 74 68 5f 65 6d 62 lo\t1234.EOT;..$heredoc_with_emb
0420 65 64 64 65 64 5f 6e 75 6c 6c 73 20 3d 20 3c 3c 3c 45 4f 54 0a 68 65 6c 6c 6f 5c 30 77 6f 72 6c edded_nulls.=.<<<EOT.hello\0worl
0440 64 5c 30 68 65 6c 6c 6f 0a 5c 30 68 65 6c 6c 6f 5c 30 0a 45 4f 54 3b 0a 0a 24 68 65 72 65 64 6f d\0hello.\0hello\0.EOT;..$heredo
0460 63 5f 77 69 74 68 5f 68 65 78 61 5f 6f 63 74 61 6c 20 3d 20 3c 3c 3c 45 4f 54 0a 68 65 6c 6c 6f c_with_hexa_octal.=.<<<EOT.hello
0480 5c 30 5c 31 30 30 5c 78 61 61 77 6f 72 6c 64 5c 30 68 65 6c 6c 6f 0a 5c 30 68 65 6c 6c 6f 5c 30 \0\100\xaaworld\0hello.\0hello\0
04a0 0a 45 4f 54 3b 0a 0a 24 68 65 72 65 64 6f 63 5f 73 74 72 69 6e 67 73 20 3d 20 61 72 72 61 79 28 .EOT;..$heredoc_strings.=.array(
04c0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 65 6d 70 74 79 5f 68 65 72 65 64 ....................$empty_hered
04e0 6f 63 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 68 65 72 65 64 6f 63 5f oc,....................$heredoc_
0500 77 69 74 68 5f 6e 65 77 6c 69 6e 65 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 with_newline,...................
0520 20 24 68 65 72 65 64 6f 63 5f 77 69 74 68 5f 63 68 61 72 61 63 74 65 72 73 2c 0a 20 20 20 20 20 .$heredoc_with_characters,......
0540 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 68 65 72 65 64 6f 63 5f 77 69 74 68 5f 6e 65 77 6c ..............$heredoc_with_newl
0560 69 6e 65 5f 61 6e 64 5f 74 61 62 73 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ine_and_tabs,...................
0580 20 24 68 65 72 65 64 6f 63 5f 77 69 74 68 5f 61 6c 70 68 61 6e 75 6d 65 72 69 63 73 2c 0a 20 20 .$heredoc_with_alphanumerics,...
05a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 68 65 72 65 64 6f 63 5f 77 69 74 68 5f 65 .................$heredoc_with_e
05c0 6d 62 65 64 64 65 64 5f 6e 75 6c 6c 73 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 mbedded_nulls,..................
05e0 20 20 24 68 65 72 65 64 6f 63 5f 77 69 74 68 5f 68 65 78 61 5f 6f 63 74 61 6c 0a 20 20 20 20 20 ..$heredoc_with_hexa_octal......
0600 20 20 20 20 20 20 20 20 20 20 20 20 20 20 29 3b 0a 0a 24 6d 61 73 6b 20 3d 20 22 66 74 68 31 32 ..............);..$mask.=."fth12
0620 5c 6e 65 36 37 38 39 30 5c 30 5c 78 61 61 5c 31 30 30 6f 22 3b 0a 0a 0a 2f 2f 20 6c 6f 6f 70 20 \ne67890\0\xaa\100o";...//.loop.
0640 74 68 72 6f 75 67 68 20 65 61 63 68 20 65 6c 65 6d 65 6e 74 20 6f 66 20 74 68 65 20 61 72 72 61 through.each.element.of.the.arra
0660 79 20 66 6f 72 20 73 74 72 20 61 72 67 75 6d 65 6e 74 0a 0a 66 6f 72 65 61 63 68 28 24 68 65 72 y.for.str.argument..foreach($her
0680 65 64 6f 63 5f 73 74 72 69 6e 67 73 20 61 73 20 24 73 74 72 29 20 7b 0a 20 20 20 20 20 20 65 63 edoc_strings.as.$str).{.......ec
06a0 68 6f 20 22 5c 6e 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 ho."\n--.Iteration.with.str.valu
06c0 65 20 61 73 20 5c 22 24 73 74 72 5c 22 20 2d 2d 5c 6e 22 3b 0a 20 20 20 20 20 20 76 61 72 5f 64 e.as.\"$str\".--\n";.......var_d
06e0 75 6d 70 28 20 73 74 72 63 73 70 6e 28 24 73 74 72 2c 24 6d 61 73 6b 29 20 29 3b 20 2f 2f 20 77 ump(.strcspn($str,$mask).);.//.w
0700 69 74 68 20 64 65 66 61 75 6c 74 20 73 74 61 72 74 20 61 6e 64 20 6c 65 6e 20 76 61 6c 75 65 73 ith.default.start.and.len.values
0720 0a 7d 3b 0a 0a 65 63 68 6f 20 22 44 6f 6e 65 22 0a 3f 3e 0a 2d 2d 45 58 50 45 43 54 46 2d 2d 0a .};..echo."Done".?>.--EXPECTF--.
0740 2a 2a 2a 20 54 65 73 74 69 6e 67 20 73 74 72 63 73 70 6e 28 29 20 3a 20 77 69 74 68 20 68 65 72 ***.Testing.strcspn().:.with.her
0760 65 64 6f 63 20 73 74 72 69 6e 67 73 20 2a 2a 2a 0a 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 77 edoc.strings.***..--.Iteration.w
0780 69 74 68 20 73 74 72 20 76 61 6c 75 65 20 61 73 20 22 22 20 2d 2d 0a 69 6e 74 28 30 29 0a 0a 2d ith.str.value.as."".--.int(0)..-
07a0 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 61 73 20 22 0a -.Iteration.with.str.value.as.".
07c0 0a 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 .".--.int(0)..--.Iteration.with.
07e0 73 74 72 20 76 61 6c 75 65 20 61 73 20 22 66 69 72 73 74 20 6c 69 6e 65 20 6f 66 20 68 65 72 65 str.value.as."first.line.of.here
0800 64 6f 63 20 73 74 72 69 6e 67 0a 73 65 63 6f 6e 64 20 6c 69 6e 65 20 6f 66 20 68 65 72 65 64 6f doc.string.second.line.of.heredo
0820 63 20 73 74 72 69 6e 67 0a 74 68 69 72 64 20 6c 69 6e 65 20 6f 66 20 68 65 72 65 64 6f 63 73 74 c.string.third.line.of.heredocst
0840 72 69 6e 67 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 ring".--.int(0)..--.Iteration.wi
0860 74 68 20 73 74 72 20 76 61 6c 75 65 20 61 73 20 22 68 65 6c 6c 6f 09 77 6f 72 6c 64 0a 68 65 6c th.str.value.as."hello.world.hel
0880 6c 6f 0a 77 6f 72 6c 64 0a 22 20 2d 2d 0a 69 6e 74 28 30 29 0a 0a 2d 2d 20 49 74 65 72 61 74 69 lo.world.".--.int(0)..--.Iterati
08a0 6f 6e 20 77 69 74 68 20 73 74 72 20 76 61 6c 75 65 20 61 73 20 22 68 65 6c 6c 6f 31 32 33 77 6f on.with.str.value.as."hello123wo
08c0 72 6c 64 34 35 36 0a 31 32 33 34 68 65 6c 6c 6f 09 31 32 33 34 22 20 2d 2d 0a 69 6e 74 28 30 29 rld456.1234hello.1234".--.int(0)
08e0 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 61 73 ..--.Iteration.with.str.value.as
0900 20 22 68 65 6c 6c 6f 00 77 6f 72 6c 64 00 68 65 6c 6c 6f 0a 00 68 65 6c 6c 6f 00 22 20 2d 2d 0a ."hello.world.hello..hello.".--.
0920 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 74 72 20 76 61 int(0)..--.Iteration.with.str.va
0940 6c 75 65 20 61 73 20 22 68 65 6c 6c 6f 00 40 aa 77 6f 72 6c 64 00 68 65 6c 6c 6f 0a 00 68 65 6c lue.as."hello.@.world.hello..hel
0960 6c 6f 00 22 20 2d 2d 0a 69 6e 74 28 30 29 0a 44 6f 6e 65 0a lo.".--.int(0).Done.