Skip to content

Commit 7840133

Browse files
authored
strcspnの変更履歴と例を追記 (#165)
* strcspnの変更履歴と例を追記 * 表現の改善: 以前 → より前
1 parent 89b09cd commit 7840133

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

reference/strings/functions/strcspn.xml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 422bb032237525aaf50e6a43f33362a2c610a1d7 Maintainer: hirokawa Status: ready -->
4-
<!-- CREDITS: shimooka,mumumu -->
3+
<!-- EN-Revision: 89990d6588947665d4e9c029ee83696f1a9d3d11 Maintainer: hirokawa Status: ready -->
4+
<!-- CREDITS: shimooka,mumumu,jdkfx -->
55
<refentry xml:id="function.strcspn" xmlns="http://docbook.org/ns/docbook">
66
<refnamediv>
77
<refname>strcspn</refname>
@@ -123,6 +123,15 @@
123123
</row>
124124
</thead>
125125
<tbody>
126+
<row>
127+
<entry>8.4.0</entry>
128+
<entry>
129+
<simpara>
130+
PHP 8.4.0 より前のバージョンでは、 <parameter>characters</parameter> が空の文字列の場合、
131+
<parameter>string</parameter> 内の最初の null バイトで探索が誤って停止してしまうことがありました。
132+
</simpara>
133+
</entry>
134+
</row>
126135
<row>
127136
<entry>8.0.0</entry>
128137
<entry>
@@ -141,29 +150,26 @@
141150
<programlisting role="php">
142151
<![CDATA[
143152
<?php
144-
$a = strcspn('abcd', 'apple');
145-
$b = strcspn('abcd', 'banana');
146-
$c = strcspn('hello', 'l');
147-
$d = strcspn('hello', 'world');
148-
$e = strcspn('abcdhelloabcd', 'abcd', -9);
149-
$f = strcspn('abcdhelloabcd', 'abcd', -9, -5);
153+
$a = strcspn('banana', 'a');
154+
$b = strcspn('banana', 'abcd');
155+
$c = strcspn('banana', 'z');
156+
$d = strcspn('abcdhelloabcd', 'a', -9);
157+
$e = strcspn('abcdhelloabcd', 'a', -9, -5);
150158
151159
var_dump($a);
152160
var_dump($b);
153161
var_dump($c);
154162
var_dump($d);
155163
var_dump($e);
156-
var_dump($f);
157164
?>
158165
]]>
159166
</programlisting>
160167
&example.outputs;
161168
<screen>
162169
<![CDATA[
170+
int(1)
163171
int(0)
164-
int(0)
165-
int(2)
166-
int(2)
172+
int(6)
167173
int(5)
168174
int(4)
169175
]]>

0 commit comments

Comments
 (0)