strrpos

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Find the position of the last occurrence of a substring in a string
<?php strrpos(string $haystack, string $needle, int $offset = 0): int|false
<?php         if (str_contains($table, '.')) {

            $table = substr_replace($table, '.'.$this->tablePrefix, strrpos($table, '.'), 1);



            return collect(explode('.', $table))

                ->map($this->wrapValue(...))
<?php     protected function createIndexName($type, array $columns)

    {

        $table = str_contains($this->table, '.')

            ? substr_replace($this->table, '.'.$this->prefix, strrpos($this->table, '.'), 1)

            : $this->prefix.$this->table;



        $index = strtolower($table.'_'.implode('_', $columns).'_'.$type);
<?php     {

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



        $position = strrpos($header, 'Bearer ');



        if ($position !== false) {

            $header = substr($header, $position + 7);
<?php             return $subject;

        }



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



        if ($position === false) {

            return $subject;
<?php             return $subject;

        }



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



        if ($position !== false) {

            return substr_replace($subject, $replace, $position, strlen($search));
<?php         $relativePath = str_replace($this->testsPath, '', TestSuite::getInstance()->getFilename());




        $relativePath = substr($relativePath, 0, (int) strrpos($relativePath, '.'));



        $description = TestSuite::getInstance()->getDescription();
<?php     public function getUnqualifiedForeignTableName()

    {

        $name     = $this->_foreignTableName->getName();

        $position = strrpos($name, '.');



        if ($position !== false) {

            $name = substr($name, $position + 1);
<?php             return $class;

        }



        $pos = strrpos($class, '\\' . Proxy::MARKER . '\\');



        if ($pos === false) {

            return $class;
<?php         $staticPrefix = self::getStaticPrefix($glob, $flags);



        if (false !== ($pos = strrpos($staticPrefix, '/'))) {



            if (0 === $pos) {
<?php     public static function makeTempDir($namespace, $className)

    {

        if (false !== ($pos = strrpos($className, '\\'))) {

            $shortClass = substr($className, $pos + 1);

        } else {

            $shortClass = $className;
<?php         }



        if (isset($this->doublesSeparators[$regexFirstChar])) {

            $regexEndPos = \strrpos($regex, $this->doublesSeparators[$regexFirstChar]);

        } else {

            $regexEndPos = \strrpos($regex, $regexFirstChar);

        }
<?php         if (isset($this->doublesSeparators[$regexFirstChar])) {

            $regexEndPos = \strrpos($regex, $this->doublesSeparators[$regexFirstChar]);

        } else {

            $regexEndPos = \strrpos($regex, $regexFirstChar);

        }



        if ($regexEndPos === false) {
<?php         $first = $class[0];

        if (isset($this->prefixLengthsPsr4[$first])) {

            $subPath = $class;

            while (false !== $lastPos = strrpos($subPath, '\\')) {

                $subPath = substr($subPath, 0, $lastPos);

                $search = $subPath . '\\';

                if (isset($this->prefixDirsPsr4[$search])) {
<?php         }




        if (false !== $pos = strrpos($class, '\\')) {


            $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)

                . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
<?php         $rejectedClasses = array();



        $realSubPath = substr($filePath, strlen($basePath) + 1);

        $dotPosition = strrpos($realSubPath, '.');

        $realSubPath = substr($realSubPath, 0, $dotPosition === false ? PHP_INT_MAX : $dotPosition);



        foreach ($classes as $class) {