Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Find the position of the last occurrence of a substring in a string
strrpos(string $haystackstring $needleint $offset 0): int|false
    {

        
$header $this->header('Authorization''');



        
$position strrpos($header'Bearer ');



        if (
$position !== false) {

            
$header substr($header$position 7);
            return $subject;

        }



        
$position strrpos($subject, (string) $search);



        if (
$position === false) {

            return 
$subject;
            return $subject;

        }



        
$position strrpos($subject$search);



        if (
$position !== false) {

            return 
substr_replace($subject$replace$positionstrlen($search));