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 $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;
}
}
<?php public function __construct($size = null)
{
$this->size = is_numeric($size) ? intval($size) : self::DEFAULT_SIZE;
}
<?php public function initFromRgb($r, $g, $b)
{
$this->r = intval($r);
$this->g = intval($g);
$this->b = intval($b);
$this->a = 0;
<?php public function initFromRgb($r, $g, $b)
{
$this->r = intval($r);
$this->g = intval($g);
$this->b = intval($b);
$this->a = 0;
}
<?php {
$this->r = intval($r);
$this->g = intval($g);
$this->b = intval($b);
$this->a = 0;
}
<?php public function initFromRgba($r, $g, $b, $a = 1)
{
$this->r = intval($r);
$this->g = intval($g);
$this->b = intval($b);
$this->a = $this->alpha2gd($a);
<?php public function initFromRgba($r, $g, $b, $a = 1)
{
$this->r = intval($r);
$this->g = intval($g);
$this->b = intval($b);
$this->a = $this->alpha2gd($a);
}