Fixed strstr(), strchr() and strrchr() to be binary safe

Andrey
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
  <refentry id="function.strstr">
   <refnamediv>
    <refname>strstr</refname>
    <refpurpose>Find first occurrence of a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>string</type><methodname>strstr</methodname>
      <methodparam><type>string</type><parameter>haystack</parameter></methodparam>
      <methodparam><type>string</type><parameter>needle</parameter></methodparam>
     </methodsynopsis>
    <para>
     Returns part of <parameter>haystack</parameter> string from the
     first occurrence of <parameter>needle</parameter> to the end of
     <parameter>haystack</parameter>.
    </para>
    <para>
     If <parameter>needle</parameter> is not found, returns &false;.
    </para>
    <para>
     If <parameter>needle</parameter> is not a string, it is converted
     to an integer and applied as the ordinal value of a character.
    </para>
    <note>
     <para>
      This function is case-sensitive. For case-insensitive searches, use
      <function>stristr</function>.
     </para>
     <para>
      In PHP 4.3.0 <function>file</function> became binary safe.
     </para>
    </note>
    <para>
     <example>
      <title><function>strstr</function> example</title>
      <programlisting role="php">
<![CDATA[
$email = '[EMAIL PROTECTED]';
$domain = strstr($email, '@');
print $domain; // prints @example.com
]]>
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>ereg</function>, <function>preg_match</function>,
     <function>strchr</function>, <function>stristr</function>,
     <function>strpos</function>, <function>strrchr</function>, and
     <function>substr</function>.
    </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:"../../../../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
-->
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
  <refentry id="function.strrchr">
   <refnamediv>
    <refname>strrchr</refname>
    <refpurpose>
     Find the last occurrence of a character in a string
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>string</type><methodname>strrchr</methodname>
      <methodparam><type>string</type><parameter>haystack</parameter></methodparam>
      <methodparam><type>string</type><parameter>needle</parameter></methodparam>
     </methodsynopsis>
    <para>
     This function returns the portion of
     <parameter>haystack</parameter> which starts at the last
     occurrence of <parameter>needle</parameter> and goes until the
     end of <parameter>haystack</parameter>.
    </para>
    <para>
     Returns &false; if <parameter>needle</parameter> is not found.
    </para>
    <para>
     If <parameter>needle</parameter> contains more than one
     character, the first is used.
    </para>
    <para>
     If <parameter>needle</parameter> is not a string, it is converted
     to an integer and applied as the ordinal value of a character.
     <example>
      <title><function>strrchr</function> example</title>
      <programlisting role="php">
<![CDATA[
// get last directory in $PATH
$dir = substr(strrchr($PATH, ":"), 1);

// get everything after last newline
$text = "Line 1\nLine 2\nLine 3";
$last = substr(strrchr($text, 10), 1 );
]]>
      </programlisting>
     </example>
    </para>
    <note>
     <para>
      In PHP 4.3.0 <function>file</function> became binary safe.
     </para>
    </note>
    <para>
     See also <function>strchr</function>, <function>substr</function>,
     <function>stristr</function>, and <function>strstr</function>.
    </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:"../../../../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
-->
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
  <refentry id="function.strchr">
   <refnamediv>
    <refname>strchr</refname>
    <refpurpose>
     Find the first occurrence of a character
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>string</type><methodname>strchr</methodname>
      <methodparam><type>string</type><parameter>haystack</parameter></methodparam>
      <methodparam><type>string</type><parameter>needle</parameter></methodparam>
     </methodsynopsis>
    <para>
     This function is an alias for <function>strstr</function>, and is
     identical in every way.
    </para>
    <note>
     <para>
      In PHP 4.3.0 <function>file</function> became binary safe.
     </para>
    </note>
   </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:"../../../../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
-->

-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to