Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Get the integer value of a variable
<?php intval(mixed $value, int $base = 10): int
<?php protected function ensurePermissionsAreCorrect($path)
{
if (is_null($this->filePermission) ||
intval($this->files->chmod($path), 8) == $this->filePermission) {
return;
}
<?php }
} else {
$result = match ($options) {
SORT_NUMERIC => intval($values[0]) <=> intval($values[1]),
SORT_STRING => strcmp($values[0], $values[1]),
SORT_NATURAL => strnatcmp($values[0], $values[1]),
SORT_LOCALE_STRING => strcoll($values[0], $values[1]),
<?php public function integer($key, $default = 0)
{
return intval($this->input($key, $default));
}
<?php public function toInteger($base = 10)
{
return intval($this->value, $base);
}
<?php $exception = $caught;
}
$remainder = intval($microseconds - ((microtime(true) - $start) * 1000000));
if (! $this->earlyReturn && $remainder > 0) {
$this->usleep($remainder);
<?php {
Route::get('/foo/{id}', function (Request $request, $id) {
return $request->hasValidSignature()
&& intval($id) === 1
&& $request->has('paramEmpty')
&& $request->has('paramEmptyString')
&& $request->query('paramWithValue') === 'value'
<?php $result[3] = 1;
} elseif (preg_match($rgbPattern, $value, $matches)) {
$result = [];
$result[0] = ($matches[1] >= 0 && $matches[1] <= 255) ? intval($matches[1]) : 0;
$result[1] = ($matches[2] >= 0 && $matches[2] <= 255) ? intval($matches[2]) : 0;
$result[2] = ($matches[3] >= 0 && $matches[3] <= 255) ? intval($matches[3]) : 0;
$result[3] = 1;
<?php } elseif (preg_match($rgbPattern, $value, $matches)) {
$result = [];
$result[0] = ($matches[1] >= 0 && $matches[1] <= 255) ? intval($matches[1]) : 0;
$result[1] = ($matches[2] >= 0 && $matches[2] <= 255) ? intval($matches[2]) : 0;
$result[2] = ($matches[3] >= 0 && $matches[3] <= 255) ? intval($matches[3]) : 0;
$result[3] = 1;
} elseif (preg_match($rgbaPattern, $value, $matches)) {
<?php $result = [];
$result[0] = ($matches[1] >= 0 && $matches[1] <= 255) ? intval($matches[1]) : 0;
$result[1] = ($matches[2] >= 0 && $matches[2] <= 255) ? intval($matches[2]) : 0;
$result[2] = ($matches[3] >= 0 && $matches[3] <= 255) ? intval($matches[3]) : 0;
$result[3] = 1;
} elseif (preg_match($rgbaPattern, $value, $matches)) {
$result = [];
<?php $result[3] = 1;
} elseif (preg_match($rgbaPattern, $value, $matches)) {
$result = [];
$result[0] = ($matches[1] >= 0 && $matches[1] <= 255) ? intval($matches[1]) : 0;
$result[1] = ($matches[2] >= 0 && $matches[2] <= 255) ? intval($matches[2]) : 0;
$result[2] = ($matches[3] >= 0 && $matches[3] <= 255) ? intval($matches[3]) : 0;
$result[3] = ($matches[4] >= 0 && $matches[4] <= 1) ? $matches[4] : 0;
<?php } elseif (preg_match($rgbaPattern, $value, $matches)) {
$result = [];
$result[0] = ($matches[1] >= 0 && $matches[1] <= 255) ? intval($matches[1]) : 0;
$result[1] = ($matches[2] >= 0 && $matches[2] <= 255) ? intval($matches[2]) : 0;
$result[2] = ($matches[3] >= 0 && $matches[3] <= 255) ? intval($matches[3]) : 0;
$result[3] = ($matches[4] >= 0 && $matches[4] <= 1) ? $matches[4] : 0;
} else {
<?php $result = [];
$result[0] = ($matches[1] >= 0 && $matches[1] <= 255) ? intval($matches[1]) : 0;
$result[1] = ($matches[2] >= 0 && $matches[2] <= 255) ? intval($matches[2]) : 0;
$result[2] = ($matches[3] >= 0 && $matches[3] <= 255) ? intval($matches[3]) : 0;
$result[3] = ($matches[4] >= 0 && $matches[4] <= 1) ? $matches[4] : 0;
} else {
throw new NotReadableException(
<?php );
}
$this->quality = intval($quality);
return $this;
}
<?php public function border($width, $color = null)
{
$this->border_width = is_numeric($width) ? intval($width) : 0;
$this->border_color = is_null($color) ? '#000000' : $color;
}
<?php private function isDigit($value)
{
return is_numeric($value) ? intval($value) == $value : false;
}
}