php-doc-en/reference/strings/functions/strrchr.xml
Jakub Vrana 153fa8424c Accepts string in PHP 5
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@166307 c90b9560-bf6c-de11-be94-00142212c4b1
2004-08-13 15:56:57 +00:00

80 lines
2.4 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- 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, only the first is used in PHP 4. This behavior is different from that
of <function>strchr</function>.
</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[
<?php
// 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>
<para>
<function>strrchr</function> has been binary safe since PHP 4.3.0
</para>
<para>
See also <function>strstr</function>, <function>substr</function>, and
<function>stristr</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
-->