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 function getRegion(): string

    {

        [, , $region] = explode('.', $this->getDomainName(), 4);

        return $region;

    }

}
<?php             $cookieHeader = $this->headers['cookie'][0];

            $cookieParts = explode('; ', $cookieHeader);

        }



        $cookies = [];
<?php         $cookies = [];

        foreach ($cookieParts as $cookiePart) {

            [$cookieName, $cookieValue] = explode('=', $cookiePart, 2);

            $cookies[$cookieName] = urldecode($cookieValue);

        }

        return $cookies;
<?php             return;

        }



        $parts = explode('[', $key); // files[id_cards][jpg][] => [ 'files',  'id_cards]', 'jpg]', ']' ]

        $pointer = &$array;



        foreach ($parts as $k => $part) {
<?php     private function signalFailure(string $invocationId, \Throwable $error): void

    {

        $stackTraceAsArray = explode(PHP_EOL, $error->getTraceAsString());

        $errorFormatted = [

            'errorType' => get_class($error),

            'errorMessage' => $error->getMessage(),
<?php                 $previousErrors[] = [

                    'errorType' => get_class($previousError),

                    'errorMessage' => $previousError->getMessage(),

                    'stack' => explode(PHP_EOL, $previousError->getTraceAsString()),

                ];

            } while ($previousError->getPrevious() !== null);
<?php         $this->postJson($url, [

            'errorMessage' => $message . ' ' . ($error ? $error->getMessage() : ''),

            'errorType' => $error ? get_class($error) : 'Internal',

            'stackTrace' => $error ? explode(PHP_EOL, $error->getTraceAsString()) : [],

        ]);



        exit(1);
<?php         $stdout = $this->getActualOutput();



        [$requestId, $message, $json] = explode("\t", $stdout);



        $this->assertSame('Invoke Error', $message);
<?php         $stdout = $this->getActualOutput();



        [, , $json] = explode("\t", $stdout);



        ['previous' => $previous] = json_decode($json, true);

        $this->assertCount(count($previousErrors), $previous);
<?php         $stderr = preg_replace('/\x1b\[[0-9;]*m/', '', $stderr);




        $output = explode("\n", trim($process->getOutput()));

        $lastLine = end($output);

        if (! empty($lastLine)) {

            $result = json_decode($lastLine, true, 512, JSON_THROW_ON_ERROR);
<?php         string $stackTraceStartsWith = '#0 /var/task/'

    ): void {


        $logLines = explode("\n", $logs);

        $logLines = array_filter($logLines, function (string $line): bool {

            $line = trim($line);

            return $line !== ''
<?php         $logLine = reset($logLines);




        [$requestId, $message, $json] = explode("\t", $logLine);




        $this->assertMatchesRegularExpression('/[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/', $requestId);