Supported Versions: PHP 4 >= 4.0.7, PHP 5, PHP 7, PHP 8
Checks if the given key or index exists in the array
<?php array_key_exists(string|int|float|bool|resource|null $key, array $array): bool
<?php ->call('proxyPull', ['foo']);
$this->assertEquals('baz', $component->pullResult['foo']);
$this->assertFalse(array_key_exists('bob', $component->pullResult));
}
}
<?php $parent = $route->parentOfParameter($parameterName);
if ($parent instanceof UrlRoutable && array_key_exists($parameterName, $route->bindingFields())) {
$model = $parent->resolveChildRouteBinding($parameterName, $parameterValue, $route->bindingFieldFor($parameterName));
} else {
if ($route->allowsTrashedBindings()) {
<?php if( !empty($new_diff) )
$difference[$key] = $new_diff;
}
} else if( !array_key_exists($key,$array2) || $array2[$key] !== $value ) {
$difference[$key] = $value;
}
}
<?php protected function filterData($data, $rules)
{
return array_filter($data, function ($key) use ($rules) {
return array_key_exists('*', $rules);
}, ARRAY_FILTER_USE_KEY);
}
<?php return $target->setRelation($key, $value);
}
if (array_key_exists($key, $target->getCasts()) && enum_exists($target->getCasts()[$key]) && $value === '') {
$value = null;
}
<?php protected function filterRelations($data, $rules)
{
return array_filter($data, function ($key) use ($rules) {
return array_key_exists($key, $rules) || in_array($key, $rules);
}, ARRAY_FILTER_USE_KEY);
}
<?php throw new \LogicException('Something went wrong');
}
if (!is_numeric($segment) && array_key_exists($segment, $segmentRules)) {
$segmentRules = $segmentRules[$segment];
$has = true;
continue;
<?php continue;
}
if (is_numeric($segment) && array_key_exists('*', $segmentRules)) {
$segmentRules = $segmentRules['*'];
$has = true;
continue;
<?php }
if (! array_key_exists('key', $meta)) {
return new $class;
}
<?php static function setParentChild($parent, $key, $tag, $id) { store($parent)->push('children', [$tag, $id], $key); }
static function setPreviouslyRenderedChildren($component, $children) { store($component)->set('previousChildren', $children); }
static function hasPreviouslyRenderedChild($parent, $key) {
return array_key_exists($key, store($parent)->get('previousChildren', []));
}
static function getPreviouslyRenderedChild($parent, $key)
<?php if (array_key_exists($name, request()->query()) && $value === $default) {
return null;
}
<?php ->keys()
->each(function($ruleKey) use ($data) {
throw_unless(
array_key_exists(Utils::beforeFirstDot($ruleKey), $data),
new \Exception('No property found for validation: ['.$ruleKey.']')
);
});
<?php protected static function substituteNameBindingForCallParameter($parameter, array &$parameters, int &$paramIndex)
{
if (! array_key_exists($paramIndex, $parameters)) {
return;
}
<?php return;
}
if (! array_key_exists($paramName = $parameter->getName(), $parameters)) {
<?php if (array_key_exists($paramName, $parameters) && ! $parameters[$paramName] instanceof $className) {
$parameters[$paramName] = static::getImplicitBinding($container, $className, $parameters[$paramName]);
} elseif (array_key_exists($className, $parameters) && ! $parameters[$className] instanceof $className) {
$parameters[$className] = static::getImplicitBinding($container, $className, $parameters[$className]);