Skip to content

strcspnの変更履歴と例を追記 #165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions reference/strings/functions/strcspn.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 422bb032237525aaf50e6a43f33362a2c610a1d7 Maintainer: hirokawa Status: ready -->
<!-- CREDITS: shimooka,mumumu -->
<!-- EN-Revision: 89990d6588947665d4e9c029ee83696f1a9d3d11 Maintainer: hirokawa Status: ready -->
<!-- CREDITS: shimooka,mumumu,jdkfx -->
<refentry xml:id="function.strcspn" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>strcspn</refname>
Expand Down Expand Up @@ -123,6 +123,15 @@
</row>
</thead>
<tbody>
<row>
<entry>8.4.0</entry>
<entry>
<simpara>
PHP 8.4.0 より前のバージョンでは、 <parameter>characters</parameter> が空の文字列の場合、
<parameter>string</parameter> 内の最初の null バイトで探索が誤って停止してしまうことがありました。
</simpara>
</entry>
</row>
<row>
<entry>8.0.0</entry>
<entry>
Expand All @@ -141,29 +150,26 @@
<programlisting role="php">
<![CDATA[
<?php
$a = strcspn('abcd', 'apple');
$b = strcspn('abcd', 'banana');
$c = strcspn('hello', 'l');
$d = strcspn('hello', 'world');
$e = strcspn('abcdhelloabcd', 'abcd', -9);
$f = strcspn('abcdhelloabcd', 'abcd', -9, -5);
$a = strcspn('banana', 'a');
$b = strcspn('banana', 'abcd');
$c = strcspn('banana', 'z');
$d = strcspn('abcdhelloabcd', 'a', -9);
$e = strcspn('abcdhelloabcd', 'a', -9, -5);

var_dump($a);
var_dump($b);
var_dump($c);
var_dump($d);
var_dump($e);
var_dump($f);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
int(1)
int(0)
int(0)
int(2)
int(2)
int(6)
int(5)
int(4)
]]>
Expand Down