in_array

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     {

        if (method_exists($hook, 'provide')) $hook::provide();



        if (in_array($hook, static::$componentHooks)) return;



        static::$componentHooks[] = $hook;

    }
<?php         }



        foreach ($values as $key => $value) {

            if (in_array(Utils::beforeFirstDot($key), $publicProperties)) {

                data_set($this, $key, $value);

            }

        }
<?php             $names = static::getListenerEventNames($this->component);



            if (! in_array($name, $names)) {

                throw new EventHandlerDoesNotExist($name);

            }
<?php     {

        $component = Livewire::test(ReceivesEvents::class);



        $this->assertTrue(in_array('bar', $component->effects['listeners']));

    }
<?php         $component->call('dispatchGoo');



        $this->assertTrue(in_array(['name' => 'goo', 'params' => ['car']], $component->effects['dispatches']));

    }
<?php         $component->call('dispatchSelfGoo');



        $this->assertTrue(in_array(['self' => true, 'name' => 'goo', 'params' => ['car']], $component->effects['dispatches']));

    }
<?php         $component->call('dispatchToComponentUsingClassname');



        $this->assertTrue(in_array(['to' => 'livewire.features.support-events.it-can-receive-event-using-classname', 'name' => 'foo', 'params' => ['test']], $component->effects['dispatches']));

    }
<?php         if (in_array($mimeType, ['application/octet-stream', 'inode/x-empty', 'application/x-empty'])) {

            $detector = new FinfoMimeTypeDetector();



            $mimeType = $detector->detectMimeTypeFromPath($this->path) ?: 'text/plain';
<?php             'jpg', 'jpeg', 'mpga', 'webp', 'wma',

        ]);



        return in_array($this->guessExtension(),  $supportedPreviewTypes);

    }



    public function readStream()
<?php         }



        foreach ($values as $key => $value) {

            if (in_array(Utils::beforeFirstDot($key), $publicProperties)) {

                data_set($this, $key, $value);

            }

        }
<?php             if (! class_exists($cast)) continue;



            if (

                in_array(CastsAttributes::class, class_implements($cast))

                && isset($attributes[$key])

                ) {

                $attributes[$key] = $model->getAttributes()[$key];
<?php     protected function filterRelations($data, $rules)

    {

        return array_filter($data, function ($key) use ($rules) {

            return array_key_exists($key, $rules) || in_array($key, $rules);

        }, ARRAY_FILTER_USE_KEY);

    }
<?php                 continue;

            }



            if (is_numeric($segment) && in_array('*', $segmentRules, true)) {

                $has = true;

                $end = true;

                continue;
<?php                 continue;

            }



            if (in_array($segment, $segmentRules, true)) {

                $has = true;

                $end = true;

                continue;
<?php     function skip()

    {

        return ! in_array(WithPagination::class, class_uses_recursive($this->component));

    }



    function boot()