Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return part of a string
<?php substr(string $string, int $offset, ?int $length = null): string
<?php         }

        if (!empty($autoload['psr-4'])) {

            foreach ($autoload['psr-4'] as $namespace => $dirs) {

                if ($namespace !== '' && '\\' !== substr($namespace, -1)) {

                    throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");

                }

            }
<?php             list($package, $installPath) = $item;



            if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {

                $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));

            }



            foreach ($package->getIncludePaths() as $includePath) {
<?php         $baseDir = '';

        if (strpos($path.'/', $vendorPath.'/') === 0) {

            $path = substr($path, strlen($vendorPath));

            $baseDir = '$vendorDir';



            if ($path !== false) {
<?php     {

        $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];

        if ("'" === $lastChar || '"' === $lastChar) {

            $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;

        } else {

            $vendorPathToTargetDirCode .= " . '/autoload_real.php'";

        }
<?php         }



        if ($this->apcu) {

            $apcuPrefix = var_export(($this->apcuPrefix !== null ? $this->apcuPrefix : substr(base64_encode(md5(uniqid('', true), true)), 0, -3)), true);

            $file .= <<<APCU

        \$loader->setApcuPrefix($apcuPrefix);
<?php         $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";

        $appBaseDirPharCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";



        $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);

        $absoluteVendorPharPathCode = ' => ' . substr(var_export(rtrim('phar://' . $vendorDir, '\\/') . '/', true), 0, -1);

        $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);

        $absoluteAppBaseDirPharCode = ' => ' . substr(var_export(rtrim('phar://' . $baseDir, '\\/') . '/', true), 0, -1);
<?php         $appBaseDirPharCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";



        $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);

        $absoluteVendorPharPathCode = ' => ' . substr(var_export(rtrim('phar://' . $vendorDir, '\\/') . '/', true), 0, -1);

        $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);

        $absoluteAppBaseDirPharCode = ' => ' . substr(var_export(rtrim('phar://' . $baseDir, '\\/') . '/', true), 0, -1);
<?php         $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);

        $absoluteVendorPharPathCode = ' => ' . substr(var_export(rtrim('phar://' . $vendorDir, '\\/') . '/', true), 0, -1);

        $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);

        $absoluteAppBaseDirPharCode = ' => ' . substr(var_export(rtrim('phar://' . $baseDir, '\\/') . '/', true), 0, -1);



        $initializer = '';
<?php         $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);

        $absoluteVendorPharPathCode = ' => ' . substr(var_export(rtrim('phar://' . $vendorDir, '\\/') . '/', true), 0, -1);

        $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);

        $absoluteAppBaseDirPharCode = ' => ' . substr(var_export(rtrim('phar://' . $baseDir, '\\/') . '/', true), 0, -1);



        $initializer = '';

        $prefix = "\0Composer\Autoload\ClassLoader\0";
<?php         foreach ((array) $loader as $prop => $value) {

            if ($value && 0 === strpos($prop, $prefix)) {

                $maps[substr($prop, $prefixLen)] = $value;

            }

        }
<?php                 continue;

            }

            if (null !== $package->getTargetDir() && $package !== $rootPackage) {

                $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));

            }



            foreach ($autoload[$type] as $namespace => $paths) {
<?php         if (isset($this->prefixLengthsPsr4[$first])) {

            $subPath = $class;

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

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

                $search = $subPath . '\\';

                if (isset($this->prefixDirsPsr4[$search])) {

                    $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
<?php                 $subPath = substr($subPath, 0, $lastPos);

                $search = $subPath . '\\';

                if (isset($this->prefixDirsPsr4[$search])) {

                    $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);

                    foreach ($this->prefixDirsPsr4[$search] as $dir) {

                        if (file_exists($file = $dir . $pathEnd)) {

                            return $file;
<?php         if (false !== $pos = strrpos($class, '\\')) {


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

                . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);

        } else {
<?php         if (false !== $pos = strrpos($class, '\\')) {


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

                . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);

        } else {


            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;