php-doc-en/reference/mbstring/functions/mb-substr.xml
Christoph Michael Becker 92f1b8b177 Generate ext/mbstring methodsynopses based on stubs
Closes GH-190.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@352028 c90b9560-bf6c-de11-be94-00142212c4b1
2020-12-12 16:32:35 +00:00

136 lines
4.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.mb-substr" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>mb_substr</refname>
<refpurpose>Get part of string</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>mb_substr</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
<methodparam><type>int</type><parameter>start</parameter></methodparam>
<methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>length</parameter><initializer>&null;</initializer></methodparam>
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>encoding</parameter><initializer>&null;</initializer></methodparam>
</methodsynopsis>
<para>
Performs a multi-byte safe
<function>substr</function> operation based on
number of characters. Position is
counted from the beginning of
<parameter>string</parameter>. First character's position is
0. Second character position is 1, and so on.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>string</parameter></term>
<listitem>
<para>
The <type>string</type> to extract the substring from.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>start</parameter></term>
<listitem>
<para>
If <parameter>start</parameter> is non-negative, the returned string
will start at the <parameter>start</parameter>'th position in
<parameter>string</parameter>, counting from zero. For instance,
in the string '<literal>abcdef</literal>', the character at
position <literal>0</literal> is '<literal>a</literal>', the
character at position <literal>2</literal> is
'<literal>c</literal>', and so forth.
</para>
<para>
If <parameter>start</parameter> is negative, the returned string
will start at the <parameter>start</parameter>'th character
from the end of <parameter>string</parameter>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>length</parameter></term>
<listitem>
<para>
Maximum number of characters to use from <parameter>string</parameter>. If
omitted or <literal>NULL</literal> is passed, extract all characters to
the end of the string.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>encoding</parameter></term>
<listitem>
&mbstring.encoding.parameter;
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<function>mb_substr</function> returns the portion of
<parameter>string</parameter> specified by the
<parameter>start</parameter> and
<parameter>length</parameter> parameters.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&mbstring.changelog.encoding-nullable;
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>mb_strcut</function></member>
<member><function>mb_internal_encoding</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->