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 $otherComposers = $filesystem->listContents('src', true)

    ->filter(function(StorageAttributes $item) { return $item->isFile(); })

    ->filter(function(FileAttributes $item) { return substr($item->path(), -5) === '.json'; })

    ->map(function(FileAttributes $item) { return $item->path(); })

    ->toArray();
<?php $composerFiles = $filesystem->listContents('src', true)

    ->filter(function(StorageAttributes $item) { return $item->isFile(); })

    ->filter(function(FileAttributes $item) { return substr($item->path(), -5) === '.json'; })

    ->map(function(FileAttributes $item) { return $item->path(); })

    ->toArray();
<?php function reset_function_mocks()

{

    foreach (array_keys($_ENV) as $name) {

        if (is_string($name) && substr($name, 0, 5) === '__FM:') {

            unset($_ENV[$name]);

        }

    }
<?php             }

        }



        if ('/' === substr($path, -1)) {

            return new DirectoryAttributes(rtrim($path, '/'));

        }
<?php             $path = $this->prefixer->stripPrefix($metadata['Key'] ?? $metadata['Prefix']);

        }



        if (substr($path, -1) === '/') {

            return new DirectoryAttributes(rtrim($path, '/'));

        }
<?php         $object = @ftp_raw($this->connection(), 'STAT ' . $location);



        if (empty($object) || count($object) < 3 || substr($object[1], 0, 5) === "ftpd:") {

            throw UnableToRetrieveMetadata::create($path, $type, error_get_last()['message'] ?? '');

        }
<?php     private function listingItemIsDirectory(string $permissions): bool

    {

        return substr($permissions, 0, 1) === 'd';

    }



    private function normalizeUnixTimestamp(string $month, string $day, string $timeOrYear): int
<?php     private function normalizePermissions(string $permissions): int

    {


        $permissions = substr($permissions, 1);




        $map = ['-' => '0', 'r' => '4', 'w' => '2', 'x' => '1'];
<?php         $response = ftp_raw($connection, "OPTS UTF8 ON");



        if ( ! in_array(substr($response[0], 0, 3), ['200', '202'])) {

            throw new UnableToEnableUtf8Mode(

                'Could not set UTF-8 mode for connection: ' . $options->host() . '::' . $options->port()

            );
<?php         $info = $object->info();

        $lastModified = strtotime($info['updated']);



        if (substr($path, -1, 1) === '/') {

            return new DirectoryAttributes(rtrim($path, '/'), null, $lastModified);

        }
<?php         $listedDirectories = [];



        foreach ($this->files as $path => $file) {

            if (substr($path, 0, $prefixLength) === $prefix) {

                $subPath = substr($path, $prefixLength);

                $dirname = dirname($subPath);
<?php         foreach ($this->files as $path => $file) {

            if (substr($path, 0, $prefixLength) === $prefix) {

                $subPath = substr($path, $prefixLength);

                $dirname = dirname($subPath);



                if ($dirname !== '.') {
<?php                 }



                $dummyFilename = self::DUMMY_FILE_FOR_FORCED_LISTING_IN_FLYSYSTEM_TEST;

                if (substr($path, -strlen($dummyFilename)) === $dummyFilename) {

                    continue;

                }
<?php     public function stripPrefix(string $path): string

    {


        return substr($path, strlen($this->prefix));

    }



    public function stripDirectoryPrefix(string $path): string
<?php     {

        $prefixedPath = $this->prefixPath(rtrim($path, '\\/'));



        if ((substr($prefixedPath, -1) === $this->separator) || $prefixedPath === '') {

            return $prefixedPath;

        }