Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Translate characters or replace substrings
<?php strtr(string $string, string $from, string $to): string
<?php             $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";

            if (!isset($classMap[$class])) {

                $classMap[$class] = $pathCode;

            } elseif ($this->io && $classMap[$class] !== $pathCode && !Preg::isMatch('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {

                $ambiguousClasses[$class][] = $path;

            }

        }
<?php             if (file_exists($dir)) {


                $dirMatch = preg_quote(strtr(realpath($dir), '\\', '/'));

                foreach ($excluded as $index => $pattern) {


                    $pattern = Preg::replace('{^(([^.+*?\[^\]$(){}=!<>|:\\\\#-]+|\\\\[.+*?\[^\]$(){}=!<>|:#-])*).*}', '$1', $pattern);
<?php         }



        foreach ($maps as $prop => $value) {

            $value = strtr(

                var_export($value, true),

                array(

                    $absoluteVendorPathCode => $vendorPathCode,

                    $absoluteVendorPharPathCode => $vendorPharPathCode,

                    $absoluteAppBaseDirCode => $appBaseDirCode,

                    $absoluteAppBaseDirPharCode => $appBaseDirPharCode,

                )

            );

            $value = ltrim(Preg::replace('/^ */m', '    $0$0', $value));



            $file .= sprintf("    public static $%s = %s;\n\n", $prop, $value);
<?php                     if ($type === 'exclude-from-classmap') {


                        $path = Preg::replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));




                        $path = strtr($path, array('\\*\\*' => '.+?', '\\*' => '[^/]+?'));
<?php                         $path = Preg::replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));




                        $path = strtr($path, array('\\*\\*' => '.+?', '\\*' => '[^/]+?'));




                        $updir = null;
<?php                             $path

                        );

                        if (empty($installPath)) {

                            $installPath = strtr(getcwd(), '\\', '/');

                        }



                        $resolvedPath = realpath($installPath . '/' . $updir);
<?php                         }



                        $resolvedPath = realpath($installPath . '/' . $updir);

                        $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path . '($|/)';

                        continue;

                    }
<?php     private function findFileWithExtension($class, $ext)

    {


        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;



        $first = $class[0];

        if (isset($this->prefixLengthsPsr4[$first])) {
<?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;
<?php                 . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);

        } else {


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

        }



        if (isset($this->prefixesPsr0[$first])) {
<?php             }




            if ($excluded && Preg::isMatch($excluded, strtr($realPath, '\\', '/'))) {

                continue;

            }
<?php                 continue;

            }


            if ($excluded && Preg::isMatch($excluded, strtr($filePath, '\\', '/'))) {

                continue;

            }
<?php                 if (!isset($map[$class])) {

                    $map[$class] = $filePath;

                } elseif ($io && $map[$class] !== $filePath && !Preg::isMatch('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {

                    $io->writeError(

                        '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.

                        ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
<?php         $backupFile = sprintf(

            '%s/%s-%s%s',

            $rollbackDir,

            strtr(Composer::RELEASE_DATE, ' :', '_-'),

            Preg::replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),

            self::OLD_INSTALL_EXT

        );
<?php         $phar->startBuffering();



        $finderSort = function ($a, $b) {

            return strcmp(strtr($a->getRealPath(), '\\', '/'), strtr($b->getRealPath(), '\\', '/'));

        };