private static function parseRgbComponent($input, &$result)
    {
        if (preg_match('/^\\s*(\\d*(?:\\.\\d*)?)(%?)\\s*$/', $input, $matches)) {
            $result = floatval($matches[1]);
            
            if ($matches[2] === '%') {
                $result = 255 * $result / 100;
            }
            
            $result = (int)$result;
            
            if ($result < 0) $result = 0;
            if ($result > 255) $result = 255;
            
            return true;
        }
        return false;
    }
private static function parseRgbComponent($input, &$result)
    {
        if (preg_match('/^\\s*(\\d*(?:\\.\\d*)?)(%?)\\s*$/', $input, $matches)) {
            $result = floatval($matches[1]);
            
            if ($matches[2] === '%') {
                $result = 255 * $result / 100;
            }
            
            $result = (int)$result;
            
            if ($result < 0) $result = 0;
            if ($result > 255) $result = 255;
            
            return true;
        }
        return false;
    }
private static function parseRgbComponent ( $ input , & $ result ) { if ( preg_match ( '/^\\s*(\\d*(?:\\.\\d*)?)(%?)\\s*$/' , $ input , $ matches ) ) { $ result = floatval ( $ matches [ 1 ] ) ; if ( $ matches [ 2 ] === '%' ) { $ result = 255 * $ result / 100 ; } $ result = ( int ) $ result ; if ( $ result < 0 ) $ result = 0 ; if ( $ result > 255 ) $ result = 255 ; return true ; } return false ; }
Parses an RGB component.

@param string $input  Input string.
@param float  $result Hue in range [0, 255].

@return boolean
Parses an RGB component .