Supported Versions: PHP 8
Determine if a string contains a given substring
<?php str_contains(string $haystack, string $needle): bool
<?php static function containsDots($subject)
{
return str_contains($subject, '.');
}
static function dotSegments($subject)
<?php protected function buildAbilityCallback($ability, $callback)
{
return function () use ($ability, $callback) {
if (str_contains($callback, '@')) {
[$class, $method] = Str::parseCallback($callback);
} else {
$class = $callback;
<?php protected function formatAbilityToMethod($ability)
{
return str_contains($ability, '-') ? Str::camel($ability) : $ability;
}
<?php {
$credentials = array_filter(
$credentials,
fn ($key) => ! str_contains($key, 'password'),
ARRAY_FILTER_USE_KEY
);
<?php {
$credentials = array_filter(
$credentials,
fn ($key) => ! str_contains($key, 'password'),
ARRAY_FILTER_USE_KEY
);
<?php protected function isClassName($value)
{
return str_contains($value, '\\');
}
}
<?php protected function properString()
{
return is_string($this->recaller) && str_contains($this->recaller, '|');
}
<?php {
$result = serialize($value);
if ($this->connection instanceof PostgresConnection && str_contains($result, "\0")) {
$result = base64_encode($result);
}
<?php return true;
} catch (DynamoDbException $e) {
if (str_contains($e->getMessage(), 'ConditionalCheckFailed')) {
return false;
}
<?php return (int) $response['Attributes'][$this->valueAttribute]['N'];
} catch (DynamoDbException $e) {
if (str_contains($e->getMessage(), 'ConditionalCheckFailed')) {
return false;
}
<?php return (int) $response['Attributes'][$this->valueAttribute]['N'];
} catch (DynamoDbException $e) {
if (str_contains($e->getMessage(), 'ConditionalCheckFailed')) {
return false;
}
<?php return $array[$key];
}
if (! str_contains($key, '.')) {
return $array[$key] ?? value($default);
}
<?php protected static function getCallReflector($callback)
{
if (is_string($callback) && str_contains($callback, '::')) {
$callback = explode('::', $callback);
} elseif (is_object($callback) && ! $callback instanceof Closure) {
$callback = [$callback, '__invoke'];
<?php protected static function isCallableWithAtSign($callback)
{
return is_string($callback) && str_contains($callback, '@');
}
}
<?php } elseif (is_array($value)) {
throw new RuntimeException('The database connection does not support escaping arrays.');
} else {
if (str_contains($value, "\00")) {
throw new RuntimeException('Strings with null bytes cannot be escaped. Use the binary escape option.');
}