explode

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     static function dotSegments($subject)

    {

        return explode('.', $subject);

    }



    static function beforeFirstDot($subject)
<?php     static function beforeFirstDot($subject)

    {

        return head(explode('.', $subject));

    }



    static function afterFirstDot($subject) : string
<?php     {

        return collect()

            ->when(config('livewire.view_path') !== resource_path(), function ($collection) {

                return $collection->concat(explode('/',str($this->baseViewPath)->after(resource_path('views'))));

            })

            ->filter()

            ->concat($this->directories)
<?php         if (is_array($rules)) return $rules;



        return explode('|', $rules);

    }



    public static function maxUploadTime()
<?php     public function extractOriginalNameFromFilePath($path)

    {

        return base64_decode(head(explode('-', last(explode('-meta', str($path)->replace('_', '/'))))));

    }



    public static function createFromLivewire($filePath)
<?php     static function dataGetWithoutWildcardSupport($array, $key, $default)

    {

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



        $first = array_shift($segments);
<?php             <livewire:foo />

        ');



        $this->assertCount(2, explode('<!--[if BLOCK]><![endif]-->', $output));

        $this->assertCount(2, explode('<!--[if ENDBLOCK]><![endif]-->', $output));

    }
<?php         ');



        $this->assertCount(2, explode('<!--[if BLOCK]><![endif]-->', $output));

        $this->assertCount(2, explode('<!--[if ENDBLOCK]><![endif]-->', $output));

    }



    #[Test]
<?php     protected function assertOccurrences($expected, $needle, $haystack)

    {

        $this->assertEquals($expected, count(explode($needle, $haystack)) - 1);

    }

}
<?php             PHPUnit::assertContains(

                $className,

                explode(' ', $this->attribute($selector, 'class')),

                "Element [{$fullSelector}] missing class [{$className}]."

            );
<?php             PHPUnit::assertNotContains(

                $className,

                explode(' ', $this->attribute($selector, 'class')),

                "Element [{$fullSelector}] has class [{$className}]."

            );
<?php             trim(trim($class, '/'), '\\')

        );



        $namespace = collect(explode('.', $namespace))

            ->map(fn ($i) => \Illuminate\Support\Str::kebab($i))

            ->implode('.');
<?php             ->map(fn ($i) => \Illuminate\Support\Str::kebab($i))

            ->implode('.');



        $fullName = str(collect(explode('.', $class))

            ->map(fn ($i) => \Illuminate\Support\Str::kebab($i))

            ->implode('.'));
<?php             <div>@foo</div>

        ');



        $this->assertCount(3, explode('@foo', $output));

    }
<?php             <div>@foo</div>

        ');



        $this->assertCount(3, explode('@foo', $output));

    }