Current Location: Home> Function Categories> strrpos

strrpos

Calculate the last occurrence of the specified string in the target string
Name:strrpos
Category:String
Programming Language:php
One-line Description:Finds where the string last appears in another string (case sensitive).

Definition and usage

strrpos() function finds where the string last appears in another string.

Note: strrpos() function is case sensitive.

Related functions:

  • stripos() - Find where the string first appears in another string (case insensitive)
  • strpos() - Find where the string first appears in another string (case sensitive)
  • strripos() - Find the last occurrence of a string in another string (case insensitive)

Example

Find the last occurrence of "php" in the string:

 <?php
echo strrpos ( "You love php, I love php too!" , "php" ) ;
?>

Try it yourself

grammar

 strrpos ( string , find , start )
parameter describe
string Required. Specifies the string being searched.
Find Required. Specifies the characters to be searched.
start Optional. Specify where to start the search.
Similar Functions
  • Generate single-byte strings from numbers chr

    chr

    Generatesingle-bytes
  • Alias ​​of implode join

    join

    Alias​​ofimplode
  • Calculate the length of the first substring in which all characters in the string exist in the specified character set strspn

    strspn

    Calculatethelengthof
  • Output formatted string printf

    printf

    Outputformattedstrin
  • Calculate the sha1 hash value of a string sha1

    sha1

    Calculatethesha1hash
  • Convert hexadecimal string to binary string hex2bin

    hex2bin

    Converthexadecimalst
  • Get the length of the starting substring that does not match the mask strcspn

    strcspn

    Getthelengthofthesta
  • Check if the string ends with the given substring str_ends_with

    str_ends_with

    Checkifthestringends
Popular Articles