Supported Versions: PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8
Removes duplicate values from an array
<?php array_unique(array $array, int $flags = SORT_STRING): array
<?php return [
'pending_jobs' => $batch->pending_jobs,
'failed_jobs' => $batch->failed_jobs + 1,
'failed_job_ids' => json_encode(array_values(array_unique(array_merge((array) json_decode($batch->failed_job_ids, true), [$jobId])))),
];
});
<?php break;
}
$tagsChunk = array_unique($tagsChunk);
if (empty($tagsChunk)) {
continue;
<?php break;
}
$entries = array_unique(array_keys($entries));
if (count($entries) === 0) {
continue;
<?php public function unique($key = null, $strict = false)
{
if (is_null($key) && $strict === false) {
return new static(array_unique($this->items, SORT_REGULAR));
}
$callback = $this->valueRetriever($key);
<?php protected function getSelectedCommandByIndex(array $commandNames)
{
if (count($commandNames) !== count(array_unique($commandNames))) {
$uniqueCommandNames = array_map(function ($index, $value) {
return "$value [$index]";
<?php public static function except($cookies)
{
static::$neverEncrypt = array_values(array_unique(
array_merge(static::$neverEncrypt, Arr::wrap($cookies))
));
}
<?php $id = $id instanceof Arrayable ? $id->toArray() : $id;
if (is_array($id)) {
if (count($result) !== count(array_unique($id))) {
throw (new ModelNotFoundException)->setModel(
get_class($this->model), array_diff($id, $result->modelKeys())
);
<?php public function mergeFillable(array $fillable)
{
$this->fillable = array_values(array_unique(array_merge($this->fillable, $fillable)));
return $this;
}
<?php public function mergeGuarded(array $guarded)
{
$this->guarded = array_values(array_unique(array_merge($this->guarded, $guarded)));
return $this;
}
<?php public function append($attributes)
{
$this->appends = array_values(array_unique(
array_merge($this->appends, is_string($attributes) ? func_get_args() : $attributes)
));
return $this;
}
<?php public function addObservableEvents($observables)
{
$this->observables = array_unique(array_merge(
$this->observables, is_array($observables) ? $observables : func_get_args()
));
}
<?php $this->hidden = array_diff($this->hidden, $attributes);
if (! empty($this->visible)) {
$this->visible = array_values(array_unique(array_merge($this->visible, $attributes)));
}
return $this;
<?php public function makeHidden($attributes)
{
$this->hidden = array_values(array_unique(array_merge(
$this->hidden, is_array($attributes) ? $attributes : func_get_args()
)));
return $this;
}
<?php if (method_exists($class, $method = 'initialize'.class_basename($trait))) {
static::$traitInitializers[$class][] = $method;
static::$traitInitializers[$class] = array_unique(
static::$traitInitializers[$class]
);
}
}
}
<?php ]));
$attributes = Arr::except(
$this->getAttributes(), $except ? array_unique(array_merge($except, $defaults)) : $defaults
);
return tap(new static, function ($instance) use ($attributes) {