summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/strcspn_variation5.phpt
blob: a3dfa5177f174a481528877c2d3339630574e564 (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 20 0a 20 2a ($s,$start,$len),$bad_chars)...*
01a0 20 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 .Source.code:.ext/standard/strin
01c0 67 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 g.c..*.Alias.to.functions:.none.
01e0 2a 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 */../*.*.Testing.strcspn().:.wit
0200 68 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 h.different.heredoc.strings.as.s
0220 74 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 tr.argument.*/..echo."***.Testin
0240 67 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 g.strcspn().:.with.heredoc.strin
0260 67 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 gs.***\n";..//.initialing.requir
0280 65 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 ed.variables.//.defining.differe
02a0 6e 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 nt.heredoc.strings.$empty_heredo
02c0 63 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 c.=.<<<EOT.EOT;..$heredoc_with_n
02e0 65 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 ewline.=.<<<EOT.\n..EOT;..$hered
0300 6f 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 oc_with_characters.=.<<<EOT.firs
0320 74 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 t.line.of.heredoc.string.second.
0340 6c 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 line.of.heredoc.string.third.lin
0360 65 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 e.of.heredocstring.EOT;..$heredo
0380 63 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 c_with_newline_and_tabs.=.<<<EOT
03a0 0a 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 .hello\tworld\nhello\nworld\n.EO
03c0 54 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 T;..$heredoc_with_alphanumerics.
03e0 3d 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 =.<<<EOT.hello123world456.1234he
0400 6c 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 llo\t1234.EOT;..$heredoc_with_em
0420 62 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 bedded_nulls.=.<<<EOT.hello\0wor
0440 6c 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 ld\0hello.\0hello\0.EOT;..$hered
0460 6f 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 oc_with_hexa_octal.=.<<<EOT.hell
0480 6f 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 o\0\100\xaaworld\0hello.\0hello\
04a0 30 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 0.EOT;..$heredoc_strings.=.array
04c0 28 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 (....................$empty_here
04e0 64 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 doc,....................$heredoc
0500 5f 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 _with_newline,..................
0520 20 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 ..$heredoc_with_characters,.....
0540 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 6e 65 77 ...............$heredoc_with_new
0560 6c 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 line_and_tabs,..................
0580 20 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 ..$heredoc_with_alphanumerics,..
05a0 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 77 69 74 68 5f ..................$heredoc_with_
05c0 65 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 embedded_nulls,.................
05e0 20 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 ...$heredoc_with_hexa_octal.....
0600 20 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 ...............);..$mask.=."fth1
0620 32 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 2\ne67890\0\xaa\100o";...//.loop
0640 20 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 .through.each.element.of.the.arr
0660 61 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 ay.for.str.argument..foreach($he
0680 72 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 redoc_strings.as.$str).{.......e
06a0 63 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 cho."\n--.Iteration.with.str.val
06c0 75 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 ue.as.\"$str\".--\n";.......var_
06e0 64 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 dump(.strcspn($str,$mask).);.//.
0700 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 6e 20 76 61 6c 75 65 with.default.start.and.len.value
0720 73 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 s.};..echo."Done".?>.--EXPECTF--
0740 0a 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 .***.Testing.strcspn().:.with.he
0760 72 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 redoc.strings.***..--.Iteration.
0780 77 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 with.str.value.as."".--.int(0)..
07a0 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 20 22 --.Iteration.with.str.value.as."
07c0 0a 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 ..".--.int(0)..--.Iteration.with
07e0 20 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 .str.value.as."first.line.of.her
0800 65 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 edoc.string.second.line.of.hered
0820 6f 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 oc.string.third.line.of.heredocs
0840 74 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 tring".--.int(0)..--.Iteration.w
0860 69 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 ith.str.value.as."hello.world.he
0880 6c 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 llo.world.".--.int(0)..--.Iterat
08a0 69 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 ion.with.str.value.as."hello123w
08c0 6f 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 orld456.1234hello.1234".--.int(0
08e0 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 65 20 61 )..--.Iteration.with.str.value.a
0900 73 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 s."hello.world.hello..hello.".--
0920 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 74 72 20 76 .int(0)..--.Iteration.with.str.v
0940 61 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 alue.as."hello.@.world.hello..he
0960 6c 6c 6f 00 22 20 2d 2d 0a 69 6e 74 28 30 29 0a 44 6f 6e 65 0a llo.".--.int(0).Done.