private static function parseAlpha($input, &$result)
    {
        if ($input === null ||
            $input === ''
        ) {
            $result = 1;
            return true;
        }
        
        if (preg_match('/^\\s*(\\d*(?:\\.\\d*)?)(%?)\\s*$/', $input, $matches)) {
            $result = floatval($matches[1]);
            
            // Percentage
            if ($matches[2] !== '') {
                $result = $result / 100;
            }
            
            if ($result < 0) $result = 0;
            if ($result > 1) $result = 1;
            
            return true;
        }
        
        return false;
    }
private static function parseAlpha($input, &$result)
    {
        if ($input === null ||
            $input === ''
        ) {
            $result = 1;
            return true;
        }
        
        if (preg_match('/^\\s*(\\d*(?:\\.\\d*)?)(%?)\\s*$/', $input, $matches)) {
            $result = floatval($matches[1]);
            
            // Percentage
            if ($matches[2] !== '') {
                $result = $result / 100;
            }
            
            if ($result < 0) $result = 0;
            if ($result > 1) $result = 1;
            
            return true;
        }
        
        return false;
    }
private static function parseAlpha ( $ input , & $ result ) { if ( $ input === null || $ input === '' ) { $ result = 1 ; return true ; } if ( preg_match ( '/^\\s*(\\d*(?:\\.\\d*)?)(%?)\\s*$/' , $ input , $ matches ) ) { $ result = floatval ( $ matches [ 1 ] ) ; // Percentage if ( $ matches [ 2 ] !== '' ) { $ result = $ result / 100 ; } if ( $ result < 0 ) $ result = 0 ; if ( $ result > 1 ) $ result = 1 ; return true ; } return false ; }
Parses an alpha value.

@param string $input Input string.
@param float $result Resulting alpha in range [0, 1].

@return boolean
Parses an alpha value .