Supported Versions: PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8
Computes the difference of arrays
<?php array_diff(array $array, array ...$arrays): array
<?php return [
'pending_jobs' => $batch->pending_jobs - 1,
'failed_jobs' => $batch->failed_jobs,
'failed_job_ids' => json_encode(array_values(array_diff((array) json_decode($batch->failed_job_ids, true), [$jobId]))),
];
});
<?php public function diff($items)
{
return new static(array_diff($this->items, $this->getArrayableItems($items)));
}
<?php 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 withoutEagerLoad(array $relations)
{
$relations = array_diff(array_keys($this->model->getRelations()), $relations);
return $this->with($relations);
}
<?php public function removeObservableEvents($observables)
{
$this->observables = array_diff(
$this->observables, is_array($observables) ? $observables : func_get_args()
);
}
<?php try {
return $callback();
} finally {
static::$ignoreTimestampsOn = array_values(array_diff(static::$ignoreTimestampsOn, $models));
}
}
<?php {
$attributes = is_array($attributes) ? $attributes : func_get_args();
$this->hidden = array_diff($this->hidden, $attributes);
if (! empty($this->visible)) {
$this->visible = array_values(array_unique(array_merge($this->visible, $attributes)));
<?php try {
$callback();
} finally {
static::$ignoreOnTouch = array_values(array_diff(static::$ignoreOnTouch, $models));
}
}
<?php if (count($attributes) !== count($fillable) &&
static::preventsSilentlyDiscardingAttributes()) {
$keys = array_diff(array_keys($attributes), array_keys($fillable));
if (isset(static::$discardedAttributeViolationCallback)) {
call_user_func(static::$discardedAttributeViolationCallback, $this, $keys);
<?php if ($detaching) {
$detach = array_diff($current, array_keys($records));
if (count($detach) > 0) {
$this->detach($detach);
<?php }, $middleware);
return array_values(array_filter(
array_diff(
array_unique(array_merge($this->prepends, $middleware, $this->appends)),
$this->removals
)
));
}
<?php foreach ($this->groupRemovals as $group => $removals) {
$middleware[$group] = array_values(array_filter(
array_diff($middleware[$group] ?? [], $removals)
));
}
<?php $value = is_array($value) ? $value : [$value];
return empty(array_diff($value, $headers[$key]));
}
<?php protected function checkForAlternateVerbs($request)
{
$methods = array_diff(Router::$verbs, [$request->getMethod()]);
<?php }
if (isset($options['except'])) {
$methods = array_diff($methods, (array) $options['except']);
}
return array_values($methods);