Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Absolute value
<?php abs(int|float $num): int|float
<?php public static function take($array, $limit)
{
if ($limit < 0) {
return array_slice($array, $limit, abs($limit));
}
return array_slice($array, 0, $limit);
<?php public function take($limit)
{
if ($limit < 0) {
return $this->slice($limit, abs($limit));
}
return $this->slice(0, $limit);
<?php {
if ($limit < 0) {
return new static(function () use ($limit) {
$limit = abs($limit);
$ringBuffer = [];
$position = 0;
<?php return false;
}
return abs($this->castAttribute($key, $attribute) - $this->castAttribute($key, $original)) < PHP_FLOAT_EPSILON * 4;
} elseif ($this->isEncryptedCastable($key) && ! empty(static::currentEncrypter()->getPreviousKeys())) {
return false;
} elseif ($this->hasCast($key, static::$primitiveCastTypes)) {
<?php if (isset($i)) {
return vsprintf('case when %s then %s else false end', [
'jsonb_typeof(('.$column.")::jsonb) = 'array'",
'jsonb_array_length(('.$column.')::jsonb) >= '.($i < 0 ? abs($i) : $i + 1),
]);
}
<?php case floatval($number) === 0.0:
return $precision > 0 ? static::format(0, $precision, $maxPrecision) : '0';
case $number < 0:
return sprintf('-%s', static::summarize(abs($number), $precision, $maxPrecision, $units));
case $number >= 1e15:
return sprintf('%s'.end($units), static::summarize($number / 1e15, $precision, $maxPrecision, $units));
}
<?php $count = count($count);
}
if ((int) abs($count) === 1 || static::uncountable($value) || preg_match('/^(.*)[A-Za-z0-9\x{0080}-\x{FFFF}]$/u', $value) == 0) {
return $value;
}
<?php $precision = 1 / (max($width, $height) + 1);
return abs($numerator / $denominator - $width / $height) > $precision;
}