Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Join array elements with a string
<?php implode(string $separator, array $array): string
<?php $classDirnameSegments = explode('\\', $classDirname);
return Arr::wrap(Collection::times(count($classDirnameSegments), function ($index) use ($class, $classDirnameSegments) {
$classDirname = implode('\\', array_slice($classDirnameSegments, 0, $index));
return $classDirname.'\\Policies\\'.class_basename($class).'Policy';
})->reverse()->values()->first(function ($class) {
<?php public static function using($guard, ...$others)
{
return static::class.':'.implode(',', [$guard, ...$others]);
}
<?php public static function using($guard = null, $field = null)
{
return static::class.':'.implode(',', func_get_args());
}
<?php public static function using($ability, ...$models)
{
return static::class.':'.implode(',', [$ability, ...$models]);
}
<?php public static function using($redirectToRoute = null, $passwordTimeoutSeconds = null)
{
return static::class.':'.implode(',', func_get_args());
}
<?php public function broadcast(array $channels, $event, array $payload = [])
{
$channels = implode(', ', $this->formatChannels($channels));
$payload = json_encode($payload, JSON_PRETTY_PRINT);
<?php {
$parts = array_slice(str_split($hash = sha1($key), 2), 0, 2);
return $this->directory.'/'.implode('/', $parts).'/'.$hash;
}
<?php public function getNamespace()
{
return implode('|', $this->tagIds());
}
<?php public static function join($array, $glue, $finalGlue = '')
{
if ($finalGlue === '') {
return implode($glue, $array);
}
if (count($array) === 0) {
<?php $finalItem = array_pop($array);
return implode($glue, $array).$finalGlue.$finalItem;
}
<?php }
}
return implode(' ', $classes);
}
<?php }
}
return implode(' ', $styles);
}
<?php public function implode($value, $glue = null)
{
if ($this->useAsCallable($value)) {
return implode($glue ?? '', $this->map($value)->all());
}
$first = $this->first();
<?php $first = $this->first();
if (is_array($first) || (is_object($first) && ! $first instanceof Stringable)) {
return implode($glue ?? '', $this->pluck($value)->all());
}
return implode($value ?? '', $this->items);
<?php return implode($glue ?? '', $this->pluck($value)->all());
}
return implode($value ?? '', $this->items);
}