ofs | hex dump | ascii |
---|
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 20 0a 20 2a 20 53 6f 75 72 63 | art,$len),$good_chars)...*.Sourc |
01a0 | 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 2e 63 0a 20 2a | e.code:.ext/standard/string.c..* |
01c0 | 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 2f 0a 0a 2f 2a | .Alias.to.functions:.none.*/../* |
01e0 | 0a 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 | .*.Testing.strspn().:.with.diffe |
0200 | 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 72 20 61 72 67 75 | rent.heredoc.strings.as.str.argu |
0220 | 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 20 73 74 72 73 70 | ment.*/..echo."***.Testing.strsp |
0240 | 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 73 20 2a 2a 2a 5c 6e | n().:.with.heredoc.strings.***\n |
0260 | 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 64 20 76 61 72 69 61 | ";..//.initialing.required.varia |
0280 | 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 74 20 68 65 72 65 64 | bles.//.defining.different.hered |
02a0 | 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 20 3d 20 3c 3c 3c 45 | oc.strings.$empty_heredoc.=.<<<E |
02c0 | 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 77 6c 69 6e 65 20 3d | OT.EOT;..$heredoc_with_newline.= |
02e0 | 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 63 5f 77 69 74 68 5f | .<<<EOT.\n..EOT;..$heredoc_with_ |
0300 | 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 20 6c 69 6e 65 20 6f | characters.=.<<<EOT.first.line.o |
0320 | 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 69 6e 65 20 6f 66 20 | f.heredoc.string.second.line.of. |
0340 | 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 20 6f 66 20 68 65 72 | heredoc.string.third.line.of.her |
0360 | 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 5f 77 69 74 68 5f 6e | edocstring.EOT;..$heredoc_with_n |
0380 | 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 68 65 6c 6c 6f 5c 74 | ewline_and_tabs.=.<<<EOT.hello\t |
03a0 | 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 3b 0a 0a 24 68 65 72 | world\nhello\nworld\n.EOT;..$her |
03c0 | 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 20 3c 3c 3c 45 4f 54 | edoc_with_alphanumerics.=.<<<EOT |
03e0 | 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 6c 6f 5c 74 31 32 33 | .hello123world456.1234hello\t123 |
0400 | 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 65 64 64 65 64 5f 6e | 4.EOT;..$heredoc_with_embedded_n |
0420 | 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 64 5c 30 68 65 6c 6c | ulls.=.<<<EOT.hello\0world\0hell |
0440 | 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 63 5f 77 69 74 68 5f | o.\0hello\0.EOT;..$heredoc_with_ |
0460 | 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 5c 30 5c 31 30 30 5c | hexa_octal.=.<<<EOT.hello\0\100\ |
0480 | 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 0a 45 4f 54 3b 0a 0a | xaaworld\0hello.\0hello\0.EOT;.. |
04a0 | 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 0a 20 20 20 20 20 20 | $heredoc_strings.=.array(....... |
04c0 | 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 6f 63 2c 0a 20 20 20 | .............$empty_heredoc,.... |
04e0 | 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 6e 65 | ................$heredoc_with_ne |
0500 | 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 20 24 68 65 72 65 64 | wline,....................$hered |
0520 | 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 20 20 20 20 20 20 20 | oc_with_characters,............. |
0540 | 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 69 6e 65 5f 61 6e 64 | .......$heredoc_with_newline_and |
0560 | 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 20 24 68 65 72 65 64 | _tabs,....................$hered |
0580 | 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 20 20 20 20 20 20 20 | oc_with_alphanumerics,.......... |
05a0 | 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 6d 62 65 64 64 65 64 | ..........$heredoc_with_embedded |
05c0 | 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 20 20 24 68 65 72 65 | _nulls,....................$here |
05e0 | 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 20 20 20 20 20 20 20 | doc_with_hexa_octal............. |
0600 | 20 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 | .......);..$mask.=."sfth12\ne34l |
0620 | 35 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 | 567890\0\xaa\100o";...//.loop.th |
0640 | 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 79 20 | rough.each.element.of.the.array. |
0660 | 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 65 64 | for.str.argument..foreach($hered |
0680 | 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 68 6f | oc_strings.as.$str).{.......echo |
06a0 | 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 65 20 | ."\n--.Iteration.with.str.value. |
06c0 | 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 75 6d | as.\"$str\".--\n";.......var_dum |
06e0 | 70 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 | p(.strspn($str,$mask).);.//.with |
0700 | 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 0a 7d 3b | .default.start.and.len.values.}; |
0720 | 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 2a 2a 2a | ..echo."Done".?>.--EXPECTF--.*** |
0740 | 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 68 65 72 65 64 6f 63 | .Testing.strspn().:.with.heredoc |
0760 | 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 69 74 68 20 | .strings.***..--.Iteration.with. |
0780 | 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 2d 20 49 74 | str.value.as."".--.int(0)..--.It |
07a0 | 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 0a 22 20 2d | eration.with.str.value.as."..".- |
07c0 | 2d 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 | -.int(2)..--.Iteration.with.str. |
07e0 | 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 64 6f 63 20 | value.as."first.line.of.heredoc. |
0800 | 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 63 20 73 74 | string.second.line.of.heredoc.st |
0820 | 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 72 69 6e 67 | ring.third.line.of.heredocstring |
0840 | 22 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 | ".--.int(1)..--.Iteration.with.s |
0860 | 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 6c 6f 0a 77 | tr.value.as."hello.world.hello.w |
0880 | 6f 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 | orld.".--.int(5)..--.Iteration.w |
08a0 | 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 72 6c 64 34 | ith.str.value.as."hello123world4 |
08c0 | 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 38 29 0a 0a 2d 2d | 56.1234hello.1234".--.int(8)..-- |
08e0 | 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 68 65 | .Iteration.with.str.value.as."he |
0900 | 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 69 6e 74 28 | llo.world.hello..hello.".--.int( |
0920 | 36 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 | 6)..--.Iteration.with.str.value. |
0940 | 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 6c 6f 00 22 | as."hello.@.world.hello..hello." |
0960 | 20 2d 2d 0a 69 6e 74 28 38 29 0a 44 6f 6e 65 | .--.int(8).Done |