Query: strrchr
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
STRRCHR(3) 1 STRRCHR(3) strrchr - Find the last occurrence of a character in a stringSYNOPSISstring strrchr (string $haystack, mixed $needle)DESCRIPTIONThis function returns the portion of $haystack which starts at the last occurrence of $needle and goes until the end of $haystack.PARAMETERSo $haystack - The string to search in o $needle - If $needle contains more than one character, only the first is used. This behavior is different from that of strstr(3). If $needle is not a string, it is converted to an integer and applied as the ordinal value of a character.RETURN VALUESThis function returns the portion of string, or FALSE if $needle is not found.CHANGELOG+--------+------------------------------------+ |Version | | | | | | | Description | | | | +--------+------------------------------------+ | 4.3.0 | | | | | | | This function is now binary safe. | | | | +--------+------------------------------------+EXAMPLESExample #1 strrchr(3) example <?php // get last directory in $PATH $dir = substr(strrchr($PATH, ":"), 1); // get everything after last newline $text = "Line 1 Line 2 Line 3"; $last = substr(strrchr($text, 10), 1 ); ?>NOTESNote This function is binary-safe.SEE ALSOstrstr(3), strrpos(3). PHP Documentation Group STRRCHR(3)
Related Man Pages |
---|
strstr(3) - php |
mb_strstr(3) - php |
mb_strrpos(3) - php |
stristr(3) - php |
mb_strpos(3) - php |