Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Split a string by a string
<?php explode(string $separator, string $string, int $limit = PHP_INT_MAX): array
<?php     public static function find($reference)

    {

        [$container, $path] = explode('::', $reference);



        return (new static)

            ->container(AssetContainer::find($container))
<?php     public function findById(string $id)

    {

        [$container_id, $path] = explode('::', $id);




        if (! $container = AssetContainer::find($container_id)) {
<?php             $query = array_merge($query, ['redirect' => static::$redirect]);

        }



        return explode('?', $url)[0].'?'.http_build_query($query);



        return $url;

    }
<?php         $surname = '';

        if ($name = $this->get('name')) {

            if (Str::contains($name, ' ')) {

                [$name, $surname] = explode(' ', $name);

            }

        } else {

            $name = $this->email();
<?php     public function __get($attribute)

    {

        $words = explode('_', snake_case($attribute));




        if ($words[0] === 'type') {
<?php     protected function normalizePackage()

    {

        $parts = explode('/', $this->package);



        $this->vendorSlug = str_slug(snake_case($parts[0]));

        $this->nameSlug = str_slug(snake_case($parts[1]));
<?php         $newConfig = $this->newSiteConfigs->map(function ($config, $site) {

            $newConfig = '\''.$site.'\' => '.VarExporter::export($config);

            $newConfig = collect(explode("\n", $newConfig))->map(function ($line) {

                return '        '.$line;

            })->join("\n").',';
<?php             return new static($this->shuffle()->all());

        }



        $sorts = explode('|', $sort);



        $arr = $this->all();
<?php         uasort($arr, function ($a, $b) use ($sorts) {

            foreach ($sorts as $sort) {

                $bits = explode(':', $sort);

                $sort_by = $bits[0];

                $sort_dir = array_get($bits, 1);
<?php         $id = $reference;



        if (substr_count($id, '::')) {

            [$repo, $id] = explode('::', $id, 2);

        }



        if ($repo && ! isset($this->repositories[$repo])) {
<?php             return null;

        }



        $firstSegment = explode('.', pathinfo($path, PATHINFO_FILENAME), 2)[0];



        return $this->isDate($firstSegment) ? $firstSegment : null;

    }
<?php             return $path;

        }



        $segments = explode('.', $path);



        if ($this->isDate($segments[0])) {

            return $segments[1];
<?php             return null;

        }



        $segments = explode('.', pathinfo($path, PATHINFO_FILENAME));



        if ($this->isDate($segments[0])) {

            return $segments[2] ?? null;
<?php     public function packageName()

    {

        return explode('/', $this->package())[1];

    }
<?php     public function vendorName()

    {

        return explode('/', $this->package())[0];

    }