Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Checks if a value exists in an array
<?php in_array(mixed $needle, array $haystack, bool $strict = false): bool
<?php         $rootPackageMap = array_shift($packageMap);

        if (is_array($filteredDevPackages)) {

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

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

            });

        } elseif ($filteredDevPackages) {

            $packageMap = $this->filterPackageMap($packageMap, $rootPackage);
<?php         foreach ($packageMap as $item) {

            $package = $item[0];


            if (in_array($package->getName(), $devPackageNames, true)) {

                continue;

            }
<?php         foreach ($path as $file) {

            $filePath = $file->getPathname();

            if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {

                continue;

            }
<?php         $installedRepo = new InstalledRepository(array($installedRepo, new RootPackageRepository($composer->getPackage())));

        foreach ($installedRepo->getPackages() as $package) {

            if (in_array($package->getName(), $removePackages, true)) {

                continue;

            }

            foreach ($package->getRequires() as $require => $link) {
<?php                 $value = $data;

            } elseif (isset($data['config'][$settingKey])) {

                $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);

            } elseif (isset($rawData[$settingKey]) && in_array($settingKey, $properties, true)) {

                $value = $rawData[$settingKey];

            } else {

                throw new \RuntimeException($settingKey.' is not defined');
<?php         $values = $input->getArgument('setting-value'); // what the user is trying to add/change



        $booleanValidator = function ($val) {

            return in_array($val, array('true', 'false', '1', '0'), true);

        };

        $booleanNormalizer = function ($val) {

            return $val !== 'false' && (bool) $val;
<?php             'use-github-api' => array($booleanValidator, $booleanNormalizer),

            'preferred-install' => array(

                function ($val) {

                    return in_array($val, array('auto', 'source', 'dist'), true);

                },

                function ($val) {

                    return $val;
<?php             ),

            'gitlab-protocol' => array(

                function ($val) {

                    return in_array($val, array('git', 'http', 'https'), true);

                },

                function ($val) {

                    return $val;
<?php             ),

            'store-auths' => array(

                function ($val) {

                    return in_array($val, array('true', 'false', 'prompt'), true);

                },

                function ($val) {

                    if ('prompt' === $val) {
<?php             ),

            'bin-compat' => array(

                function ($val) {

                    return in_array($val, array('auto', 'full', 'symlink'));

                },

                function ($val) {

                    return $val;
<?php             ),

            'discard-changes' => array(

                function ($val) {

                    return in_array($val, array('stash', 'true', 'false', '1', '0'), true);

                },

                function ($val) {

                    if ('stash' === $val) {
<?php             'allow-plugins' => array($booleanValidator, $booleanNormalizer),

            'platform-check' => array(

                function ($val) {

                    return in_array($val, array('php-only', 'true', 'false', '1', '0'), true);

                },

                function ($val) {

                    if ('php-only' === $val) {
<?php             ),

            'use-parent-dir' => array(

                function ($val) {

                    return in_array($val, array('true', 'false', 'prompt'), true);

                },

                function ($val) {

                    if ('prompt' === $val) {
<?php                     }



                    foreach ($vals as $val) {

                        if (!in_array($val, array('git', 'https', 'ssh'))) {

                            return 'valid protocols include: git, https, ssh';

                        }

                    }
<?php         }




        if (in_array($settingKey, array('suggest', 'extra'), true) && $input->getOption('unset')) {

            $this->configSource->removeProperty($settingKey);



            return 0;