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 fn (string $trait): string => sprintf('\%s', $trait), $this->traits))
);
$partsFQN = explode('\\', $classFQN);
$className = array_pop($partsFQN);
$namespace = implode('\\', $partsFQN);
$baseClass = sprintf('\%s', $this->class);
<?php View::renderUsing($this->output);
if ($this->isOpeningHeadline($this->buffer)) {
$this->buffer = implode(PHP_EOL, array_slice(explode(PHP_EOL, $this->buffer), 2));
}
$type = 'INFO';
<?php $this->buffer = trim($this->buffer);
$this->buffer = rtrim($this->buffer, '.').'.';
$lines = explode(PHP_EOL, $this->buffer);
$lines = array_reverse($lines);
$firstLine = array_pop($lines);
<?php $stackTrace = $throwable->stackTrace();
$frames = explode("\n", $stackTrace);
$frames = array_filter($frames);
<?php private static function getScopedDataset(string $name, string $currentTestFile): Closure|iterable
{
$matchingDatasets = array_filter(self::$datasets, function (string $key) use ($name, $currentTestFile): bool {
[$datasetScope, $datasetName] = explode(self::SEPARATOR, $key);
if ($name !== $datasetName) {
return false;
<?php return true;
}
foreach (explode('.', $key) as $segment) {
if (is_array($array) && array_key_exists($segment, $array)) {
$array = $array[$segment];
} else {
<?php return $array[$key] ?? $default;
}
foreach (explode('.', $key) as $segment) {
if (is_array($array) && array_key_exists($segment, $array)) {
$array = $array[$segment];
} else {
<?php $lastKey = count($array) - 1;
if (array_key_exists($lastKey, $array) && str_contains((string) $array[$lastKey], '..')) {
[$from] = explode('..', (string) $array[$lastKey]);
$array[$lastKey] = $line > $from ? sprintf('%s..%s', $from, $line) : sprintf('%s..%s', $line, $from);
return $array;
<?php public static function after(string $subject, string $search): string
{
return $search === '' ? $subject : array_reverse(explode($search, $subject, 2))[0];
}
<?php $dirtyFiles = array_map(
fn (string $file, string $status): string => in_array($status, ['R', 'RM'], true)
? explode(' -> ', $file)[1]
: $file, array_keys($dirtyFiles), $dirtyFiles,
);
<?php return removeAnsiEscapeSequences($process->getOutput());
};
$outputContent = explode("\n", $output());
array_pop($outputContent);
array_pop($outputContent);
array_pop($outputContent);
<?php };
if (getenv('REBUILD_SNAPSHOTS')) {
$outputContent = explode("\n", $output());
array_pop($outputContent);
array_pop($outputContent);
array_pop($outputContent);
<?php file_put_contents($snapshot, implode("\n", $outputContent));
} elseif (! getenv('EXCLUDE')) {
$output = explode("\n", $output());
array_pop($output);
array_pop($output);