summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/strspn_variation5.phpt
blob: 5b4bf7e1081e3c173d7b44869de4820e04fa0ca2 (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 77 69 74 68 20 68 65 72 65 64 6f :.usage.variations.-.with.heredo
0040 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 64 c.strings.with.default.start.and
0060 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 74 .len.args.--FILE--.<?php./*.Prot
0080 6f 74 79 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 otype..:.proto.int.strspn(string
00a0 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 20 5b .str,.string.mask.[,.int.start.[
00c0 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 69 6e ,.int.len]])..*.Description:.Fin
00e0 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 6f 6e ds.length.of.initial.segment.con
0100 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 20 66 sisting.entirely.of.characters.f
0120 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 20 20 20 20 49 66 ound.in.mask..................If
0140 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 6f 76 69 64 65 64 .start.or/and.length.is.provided
0160 20 77 6f 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 .works.like.strspn(substr($s,$st
0180 61 72 74 2c 24 6c 65 6e 29 2c 24 67 6f 6f 64 5f 63 68 61 72 73 29 0a 20 2a 20 53 6f 75 72 63 65 art,$len),$good_chars)..*.Source
01a0 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..*.
01c0 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.*/../*.
01e0 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 69 66 66 65 72 *.Testing.strspn().:.with.differ
0200 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 72 20 61 72 67 75 6d ent.heredoc.strings.as.str.argum
0220 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 20 73 74 72 73 70 6e ent.*/..echo."***.Testing.strspn
0240 28 29 20 3a 20 77 69 74 68 20 68 65 72 65 64 6f 63 20 73 74 72 69 6e 67 73 20 2a 2a 2a 5c 6e 22 ().:.with.heredoc.strings.***\n"
0260 3b 0a 0a 2f 2f 20 69 6e 69 74 69 61 6c 69 6e 67 20 72 65 71 75 69 72 65 64 20 76 61 72 69 61 62 ;..//.initialing.required.variab
0280 6c 65 73 0a 2f 2f 20 64 65 66 69 6e 69 6e 67 20 64 69 66 66 65 72 65 6e 74 20 68 65 72 65 64 6f les.//.defining.different.heredo
02a0 63 20 73 74 72 69 6e 67 73 0a 24 65 6d 70 74 79 5f 68 65 72 65 64 6f 63 20 3d 20 3c 3c 3c 45 4f c.strings.$empty_heredoc.=.<<<EO
02c0 54 0a 45 4f 54 3b 0a 0a 24 68 65 72 65 64 6f 63 5f 77 69 74 68 5f 6e 65 77 6c 69 6e 65 20 3d 20 T.EOT;..$heredoc_with_newline.=.
02e0 3c 3c 3c 45 4f 54 0a 5c 6e 0a 0a 45 4f 54 3b 0a 0a 24 68 65 72 65 64 6f 63 5f 77 69 74 68 5f 63 <<<EOT.\n..EOT;..$heredoc_with_c
0300 68 61 72 61 63 74 65 72 73 20 3d 20 3c 3c 3c 45 4f 54 0a 66 69 72 73 74 20 6c 69 6e 65 20 6f 66 haracters.=.<<<EOT.first.line.of
0320 20 68 65 72 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 .heredoc.string.second.line.of.h
0340 65 72 65 64 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 eredoc.string.third.line.of.here
0360 64 6f 63 73 74 72 69 6e 67 0a 45 4f 54 3b 0a 0a 24 68 65 72 65 64 6f 63 5f 77 69 74 68 5f 6e 65 docstring.EOT;..$heredoc_with_ne
0380 77 6c 69 6e 65 5f 61 6e 64 5f 74 61 62 73 20 3d 20 3c 3c 3c 45 4f 54 0a 68 65 6c 6c 6f 5c 74 77 wline_and_tabs.=.<<<EOT.hello\tw
03a0 6f 72 6c 64 5c 6e 68 65 6c 6c 6f 5c 6e 77 6f 72 6c 64 5c 6e 0a 45 4f 54 3b 0a 0a 24 68 65 72 65 orld\nhello\nworld\n.EOT;..$here
03c0 64 6f 63 5f 77 69 74 68 5f 61 6c 70 68 61 6e 75 6d 65 72 69 63 73 20 3d 20 3c 3c 3c 45 4f 54 0a doc_with_alphanumerics.=.<<<EOT.
03e0 68 65 6c 6c 6f 31 32 33 77 6f 72 6c 64 34 35 36 0a 31 32 33 34 68 65 6c 6c 6f 5c 74 31 32 33 34 hello123world456.1234hello\t1234
0400 0a 45 4f 54 3b 0a 0a 24 68 65 72 65 64 6f 63 5f 77 69 74 68 5f 65 6d 62 65 64 64 65 64 5f 6e 75 .EOT;..$heredoc_with_embedded_nu
0420 6c 6c 73 20 3d 20 3c 3c 3c 45 4f 54 0a 68 65 6c 6c 6f 5c 30 77 6f 72 6c 64 5c 30 68 65 6c 6c 6f lls.=.<<<EOT.hello\0world\0hello
0440 0a 5c 30 68 65 6c 6c 6f 5c 30 0a 45 4f 54 3b 0a 0a 24 68 65 72 65 64 6f 63 5f 77 69 74 68 5f 68 .\0hello\0.EOT;..$heredoc_with_h
0460 65 78 61 5f 6f 63 74 61 6c 20 3d 20 3c 3c 3c 45 4f 54 0a 68 65 6c 6c 6f 5c 30 5c 31 30 30 5c 78 exa_octal.=.<<<EOT.hello\0\100\x
0480 61 61 77 6f 72 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 aaworld\0hello.\0hello\0.EOT;..$
04a0 68 65 72 65 64 6f 63 5f 73 74 72 69 6e 67 73 20 3d 20 61 72 72 61 79 28 0a 20 20 20 20 20 20 20 heredoc_strings.=.array(........
04c0 20 20 20 20 20 20 20 20 20 20 20 20 24 65 6d 70 74 79 5f 68 65 72 65 64 6f 63 2c 0a 20 20 20 20 ............$empty_heredoc,.....
04e0 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
0500 6c 69 6e 65 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 line,....................$heredo
0520 63 5f 77 69 74 68 5f 63 68 61 72 61 63 74 65 72 73 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 c_with_characters,..............
0540 20 20 20 20 20 20 24 68 65 72 65 64 6f 63 5f 77 69 74 68 5f 6e 65 77 6c 69 6e 65 5f 61 6e 64 5f ......$heredoc_with_newline_and_
0560 74 61 62 73 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 tabs,....................$heredo
0580 63 5f 77 69 74 68 5f 61 6c 70 68 61 6e 75 6d 65 72 69 63 73 2c 0a 20 20 20 20 20 20 20 20 20 20 c_with_alphanumerics,...........
05a0 20 20 20 20 20 20 20 20 20 24 68 65 72 65 64 6f 63 5f 77 69 74 68 5f 65 6d 62 65 64 64 65 64 5f .........$heredoc_with_embedded_
05c0 6e 75 6c 6c 73 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 nulls,....................$hered
05e0 6f 63 5f 77 69 74 68 5f 68 65 78 61 5f 6f 63 74 61 6c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 oc_with_hexa_octal..............
0600 20 20 20 20 20 20 29 3b 0a 0a 24 6d 61 73 6b 20 3d 20 22 73 66 74 68 31 32 5c 6e 65 33 34 6c 35 ......);..$mask.=."sfth12\ne34l5
0620 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 74 68 72 67890\0\xaa\100o";...//.loop.thr
0640 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 79 20 66 ough.each.element.of.the.array.f
0660 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 65 64 6f or.str.argument..foreach($heredo
0680 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 68 6f 20 c_strings.as.$str).{.......echo.
06a0 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 65 20 61 "\n--.Iteration.with.str.value.a
06c0 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 75 6d 70 s.\"$str\".--\n";.......var_dump
06e0 28 20 73 74 72 73 70 6e 28 24 73 74 72 2c 24 6d 61 73 6b 29 20 29 3b 20 2f 2f 20 77 69 74 68 20 (.strspn($str,$mask).);.//.with.
0700 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 0a 7d 3b 0a default.start.and.len.values.};.
0720 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 2a 2a 2a 20 .echo."Done".?>.--EXPECTF--.***.
0740 54 65 73 74 69 6e 67 20 73 74 72 73 70 6e 28 29 20 3a 20 77 69 74 68 20 68 65 72 65 64 6f 63 20 Testing.strspn().:.with.heredoc.
0760 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 69 74 68 20 73 strings.***..--.Iteration.with.s
0780 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 2d 20 49 74 65 tr.value.as."".--.int(0)..--.Ite
07a0 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 0a 22 20 2d 2d ration.with.str.value.as."..".--
07c0 0a 69 6e 74 28 32 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(2)..--.Iteration.with.str.v
07e0 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 64 6f 63 20 73 alue.as."first.line.of.heredoc.s
0800 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 63 20 73 74 72 tring.second.line.of.heredoc.str
0820 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 72 69 6e 67 22 ing.third.line.of.heredocstring"
0840 20 2d 2d 0a 69 6e 74 28 31 29 0a 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 77 69 74 68 20 73 74 .--.int(1)..--.Iteration.with.st
0860 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 6c 6f 0a 77 6f r.value.as."hello.world.hello.wo
0880 72 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 rld.".--.int(5)..--.Iteration.wi
08a0 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 72 6c 64 34 35 th.str.value.as."hello123world45
08c0 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 38 29 0a 0a 2d 2d 20 6.1234hello.1234".--.int(8)..--.
08e0 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 68 65 6c Iteration.with.str.value.as."hel
0900 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 69 6e 74 28 36 lo.world.hello..hello.".--.int(6
0920 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
0940 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 6c 6f 00 22 20 s."hello.@.world.hello..hello.".
0960 2d 2d 0a 69 6e 74 28 38 29 0a 44 6f 6e 65 --.int(8).Done