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 |
|---|
| mb_strripos(3) - php |
| strstr(3) - php |
| mb_strrichr(3) - php |
| mb_strstr(3) - php |
| mb_strpos(3) - php |
| Similar Topics in the Unix Linux Community |
|---|
| Remove blank lines |
| Activate all Linux services script |
| Faster Line by Line String/Date Comparison of 2 Files |
| Is it possible to index substr from right to left? |
| Perl substr or similar help |