PHP » PYTHON |
login |
register |
about
|
# returns -1 when not found: pos = haystack.rfind(needle) pos = haystack.rfind(needle, offset) # raises ValueError when not found: pos = haystack.rindex(needle) pos = haystack.rindex(needle, offset) strrpos(PHP 4, PHP 5) strrpos — Find position of last occurrence of a char in a string Description
int strrpos
( string $haystack
, string $needle
[, int $offset= 0
] )
Returns the numeric position of the last occurrence of needle in the haystack string. Note that the needle in this case can only be a single character in PHP 4. If a string is passed as the needle, then only the first character of that string will be used. If needle is not found, returns FALSE. It is easy to mistake the return values for "character found at position 0" and "character not found". Here's how to detect the difference:
<?php
If needle is not a string, it is converted to an integer and applied as the ordinal value of a character.
Parameters
Return Values
See Also
|
more
Recently updated
more
Most requested
more
Last requests
|