Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Shift an element off the beginning of array
<?php array_shift(array &$array): mixed
<?php     public function parseAutoloads(array $packageMap, PackageInterface $rootPackage, $filteredDevPackages = false)

    {

        $rootPackageMap = array_shift($packageMap);

        if (is_array($filteredDevPackages)) {

            $packageMap = array_filter($packageMap, function ($item) use ($filteredDevPackages) {

                return !in_array($item[0]->getName(), $filteredDevPackages, true);
<?php     {

        $args = func_get_args();


        array_shift($args);

        $fallback = array_pop($args);



        if ($this->file->exists()) {
<?php                 return $package2;



            case self::RULE_PACKAGE_REQUIRES:

                $sourceLiteral = array_shift($literals);

                $sourcePackage = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($sourceLiteral));



                return $sourcePackage;
<?php                 return $package2->getPrettyString().' conflicts with '.$conflictTarget.'.';



            case self::RULE_PACKAGE_REQUIRES:

                $sourceLiteral = array_shift($literals);

                $sourcePackage = $this->deduplicateDefaultBranchAlias($pool->literalToPackage($sourceLiteral));


                $reasonData = $this->reasonData;
<?php         $literals = $this->policy->selectPreferredPackages($this->pool, $decisionQueue, $rule->getRequiredPackage());



        $selectedLiteral = array_shift($literals);




        if (\count($literals)) {
<?php         $io = $this->io;



        $download = function ($retry = false) use (&$sources, $io, $package, $targetDir, &$download, $prevPackage) {

            $source = array_shift($sources);

            if ($retry) {

                $io->writeError('    <warning>Now trying to download from ' . $source . '</warning>');

            }
<?php                 return $download();

            }



            array_shift($urls);

            if ($urls) {

                if ($io->isDebug()) {

                    $io->writeError('    Failed downloading '.$package->getName().': ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
<?php         $urls = $this->prepareUrls($package->getSourceUrls());



        while ($url = array_shift($urls)) {

            try {

                return $this->doDownload($package, $path, $url, $prevPackage);

            } catch (\Exception $e) {
<?php         $this->io->writeError("  - " . InstallOperation::format($package).': ', false);



        $urls = $this->prepareUrls($package->getSourceUrls());

        while ($url = array_shift($urls)) {

            try {

                $this->doInstall($package, $path, $url);

                break;
<?php         $urls = $this->prepareUrls($target->getSourceUrls());



        $exception = null;

        while ($url = array_shift($urls)) {

            try {

                $this->doUpdate($initial, $target, $path, $url);
<?php             $guessedDomain .= ':'.$portNumber;

        }



        while (null !== ($part = array_shift($urlParts))) {

            $guessedDomain .= '/' . $part;



            if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array(Preg::replace('{:\d+}', '', $guessedDomain), $configuredDomains))) {
<?php         $paths = self::getAll();



        if (empty($paths[0])) {

            array_shift($paths);

        }



        $ini = array_shift($paths);
<?php             array_shift($paths);

        }



        $ini = array_shift($paths);



        if (empty($ini)) {

            return 'A php.ini file does not exist. You will have to create one.';
<?php         $this->log[] = $fileUrl;



        if (is_array($this->expectations) && count($this->expectations) > 0 && $fileUrl === $this->expectations[0]['url'] && ($this->expectations[0]['options'] === null || $options === $this->expectations[0]['options'])) {

            $expect = array_shift($this->expectations);



            return $this->respond($fileUrl, $expect['status'], $expect['headers'], $expect['body']);

        }
<?php         $this->log[] = $command;



        if (is_array($this->expectations) && count($this->expectations) > 0 && $command === $this->expectations[0]['cmd']) {

            $expect = array_shift($this->expectations);

            $stdout = $expect['stdout'];

            $stderr = $expect['stderr'];

            $return = $expect['return'];