2007-12-07 01:14:26 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 07:57:45 +00:00
|
|
|
<!-- $Revision$ -->
|
2007-12-07 01:14:26 +00:00
|
|
|
<refentry xml:id="function.mb-substr" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
2007-09-20 20:55:38 +00:00
|
|
|
<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>str</parameter></methodparam>
|
|
|
|
<methodparam><type>int</type><parameter>start</parameter></methodparam>
|
2013-09-10 16:06:26 +00:00
|
|
|
<methodparam choice="opt"><type>int</type><parameter>length</parameter><initializer>NULL</initializer></methodparam>
|
|
|
|
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter><initializer>mb_internal_encoding()</initializer></methodparam>
|
2007-09-20 20:55:38 +00:00
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
2007-12-07 01:14:26 +00:00
|
|
|
Performs a multi-byte safe
|
2007-09-20 20:55:38 +00:00
|
|
|
<function>substr</function> operation based on
|
|
|
|
number of characters. Position is
|
|
|
|
counted from the beginning of
|
|
|
|
<parameter>str</parameter>. First character's position is
|
|
|
|
0. Second character position is 1, and so on.
|
|
|
|
</para>
|
2007-12-07 01:14:26 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
2007-09-20 20:55:38 +00:00
|
|
|
<para>
|
2007-12-07 01:14:26 +00:00
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>str</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2011-08-25 20:20:58 +00:00
|
|
|
The <type>string</type> to extract the substring from.
|
2007-12-07 01:14:26 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>start</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2015-07-31 17:10:28 +00:00
|
|
|
If <parameter>start</parameter> is non-negative, the returned string
|
|
|
|
will start at the <parameter>start</parameter>'th position in
|
2016-09-28 12:29:25 +00:00
|
|
|
<parameter>str</parameter>, counting from zero. For instance,
|
2015-07-31 17:10:28 +00:00
|
|
|
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
|
2016-09-28 12:29:25 +00:00
|
|
|
from the end of <parameter>str</parameter>.
|
2007-12-07 01:14:26 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>length</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2013-09-10 16:06:26 +00:00
|
|
|
Maximum number of characters to use from <parameter>str</parameter>. If
|
|
|
|
omitted or <literal>NULL</literal> is passed, extract all characters to
|
|
|
|
the end of the string.
|
2007-12-07 01:14:26 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>encoding</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
&mbstring.encoding.parameter;
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
2007-09-20 20:55:38 +00:00
|
|
|
</para>
|
2007-12-07 01:14:26 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
2007-09-20 20:55:38 +00:00
|
|
|
<para>
|
2007-12-07 01:14:26 +00:00
|
|
|
<function>mb_substr</function> returns the portion of
|
|
|
|
<parameter>str</parameter> specified by the
|
|
|
|
<parameter>start</parameter> and
|
|
|
|
<parameter>length</parameter> parameters.
|
2007-09-20 20:55:38 +00:00
|
|
|
</para>
|
2007-12-07 01:14:26 +00:00
|
|
|
</refsect1>
|
|
|
|
|
2015-07-31 17:10:28 +00:00
|
|
|
<refsect1 role="changelog">
|
|
|
|
&reftitle.changelog;
|
|
|
|
<para>
|
|
|
|
<informaltable>
|
|
|
|
<tgroup cols="2">
|
|
|
|
<thead>
|
|
|
|
<row>
|
|
|
|
<entry>&Version;</entry>
|
|
|
|
<entry>&Description;</entry>
|
|
|
|
</row>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<row>
|
|
|
|
<entry>5.4.8</entry>
|
|
|
|
<entry>
|
|
|
|
Passing <literal>NULL</literal> as <parameter>length</parameter>
|
|
|
|
extracts all characters to the end of the string. Prior to this version
|
|
|
|
<literal>NULL</literal> was treated the same as <literal>0</literal>.
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
</tbody>
|
|
|
|
</tgroup>
|
|
|
|
</informaltable>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
2007-12-07 01:14:26 +00:00
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
2007-09-20 20:55:38 +00:00
|
|
|
<para>
|
2007-12-07 01:14:26 +00:00
|
|
|
<simplelist>
|
|
|
|
<member><function>mb_strcut</function></member>
|
|
|
|
<member><function>mb_internal_encoding</function></member>
|
|
|
|
</simplelist>
|
2007-09-20 20:55:38 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
2007-12-07 01:14:26 +00:00
|
|
|
|
2007-09-20 20:55:38 +00:00
|
|
|
</refentry>
|
2002-04-15 00:12:54 +00:00
|
|
|
|
|
|
|
<!-- 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
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2002-04-15 00:12:54 +00:00
|
|
|
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
|
|
|
|
-->
|