<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.mb-strcut" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>mb_strcut</refname>
  <refpurpose>Get part of string</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>string</type><methodname>mb_strcut</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>
   <function>mb_strcut</function> extracts a substring from a string similarly to
   <function>mb_substr</function>, but operates on bytes instead of characters. If the
   cut position happens to be between two bytes of a multi-byte character, the cut is
   performed starting from the first byte of that character. This is also the difference
   to the <function>substr</function> function, which would simply cut the string between
   the bytes and thus result in a malformed byte sequence.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>string</parameter></term>
     <listitem>
      <para>
       The <type>string</type> being cut.
      </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 <emphasis>byte</emphasis> position in
       <parameter>string</parameter>, counting from zero. For instance,
       in the string '<literal>abcdef</literal>', the byte at
       position <literal>0</literal> is '<literal>a</literal>', the
       byte 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 byte
       counting back from the end of <parameter>string</parameter>. However, if the
       magnitude of a negative <parameter>start</parameter> is greater than the
       length of the string, the returned portion will start from the beginning of
       <parameter>string</parameter>.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>length</parameter></term>
     <listitem>
      <para>
       Length in <emphasis>bytes</emphasis>. If omitted or <literal>NULL</literal>
       is passed, extract all bytes to the end of the string.
      </para>
      <para>
       If <parameter>length</parameter> is negative, the returned string will
       end at the <parameter>length</parameter>'th byte counting back from the
       end of <parameter>string</parameter>. However, if the magnitude of a negative
       <parameter>length</parameter> is greater than the number of characters
       after the <parameter>start</parameter> position, an empty string will
       be returned.
      </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_strcut</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_substr</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
-->
