array_search

Supported Versions: PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8
Searches the array for a given value and returns the first corresponding key if successful
<?php array_search(mixed $needle, array $haystack, bool $strict = false): int|string|false
<?php     }



    function off($name, $callback) {

        $index = array_search($callback, $this->listeners[$name] ?? []);

        $indexAfter = array_search($callback, $this->listenersAfter[$name] ?? []);

        $indexBefore = array_search($callback, $this->listenersBefore[$name] ?? []);
<?php     function off($name, $callback) {

        $index = array_search($callback, $this->listeners[$name] ?? []);

        $indexAfter = array_search($callback, $this->listenersAfter[$name] ?? []);

        $indexBefore = array_search($callback, $this->listenersBefore[$name] ?? []);



        if ($index !== false) unset($this->listeners[$name][$index]);
<?php     function off($name, $callback) {

        $index = array_search($callback, $this->listeners[$name] ?? []);

        $indexAfter = array_search($callback, $this->listenersAfter[$name] ?? []);

        $indexBefore = array_search($callback, $this->listenersBefore[$name] ?? []);



        if ($index !== false) unset($this->listeners[$name][$index]);

        elseif ($indexAfter !== false) unset($this->listenersAfter[$name][$indexAfter]);
<?php     public static function hasComputedProperty($target, $property)

    {

        return array_search((string) str($property)->camel(), static::getComputedPropertyNames($target)) !== false;

    }



    public static function getComputedProperty($target, $property)
<?php     public function isReservedClassName($name)

    {

        return array_search(strtolower($name), $this->getReservedName()) !== false;

    }



    protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)
<?php                 ];



                public function deleteChild($name) {

                    unset($this->children[array_search($name, $this->children)]);

                }



                public function render()
<?php         $resolvedAliases = array_map(fn ($i) => is_object($i) ? get_class($i) : $i, $this->aliases);



        if ($name = array_search($class, $resolvedAliases)) return $name;




        foreach ($this->nonAliasedClasses as $oneOff) {
<?php             }



            foreach ($this->precompilers as $handler) {

                if (array_search($handler, $precompilers) === false) {

                    array_unshift($precompilers, $handler);



                    invade(app('blade.compiler'))->precompilers = $precompilers;
<?php                     $removals[] = function () use ($handler) {

                        $precompilers = invade(app('blade.compiler'))->precompilers;



                        $index = array_search($handler, $precompilers);



                        if ($index === false) return;
<?php     function dehydrate($target) {

        return [

            $target->format(DateTimeInterface::ATOM),

            ['type' => array_search(get_class($target), static::$types)],

        ];

    }
<?php     public function search($value, $strict = false)

    {

        if (! $this->useAsCallable($value)) {

            return array_search($value, $this->items, $strict);

        }



        foreach ($this->items as $key => $item) {
<?php             return (int) $choice[1];

        } else {

            return array_search(

                select('Which command would you like to run?', $commandNames),

                $commandNames

            );

        }

    }

}
<?php         $morphMap = Relation::morphMap();



        if (! empty($morphMap) && in_array(static::class, $morphMap)) {

            return array_search(static::class, $morphMap, true);

        }



        if (static::class === Pivot::class) {
<?php             $morphMap = Relation::morphMap();



            if (! empty($morphMap) && in_array($model, $morphMap)) {

                $model = array_search($model, $morphMap, true);

            }



            return $this->where($relation->getMorphType(), $model, null, $boolean);
<?php             $morphMap = Relation::morphMap();



            if (! empty($morphMap) && in_array($model, $morphMap)) {

                $model = array_search($model, $morphMap, true);

            }



            return $this->whereNot($relation->getMorphType(), '<=>', $model, $boolean);