protected function cleanVersion($version)
    {
        //Clear anything that is in parentheses (and the parentheses themselves) - will clear started but unclosed ones too
        $cleanVer = preg_replace('/\([^)]+\)?/', '', $version);
        //Replace with a space any character which is NOT an alphanumeric, dot (.), hyphen (-), underscore (_) or space
        $cleanVer = preg_replace('/[^0-9.a-zA-Z_ -]/', ' ', $cleanVer);

        //Remove trailing and leading spaces
        $cleanVer = trim($cleanVer);

        //Remove trailing dot (.), hyphen (-), underscore (_)
        while (in_array(substr($cleanVer, -1), array('.', '-', '_'))) {
            $cleanVer = substr($cleanVer, 0, -1);
        }
        //Remove leading dot (.), hyphen (-), underscore (_) and character v
        while (in_array(substr($cleanVer, 0, 1), array('.', '-', '_', 'v', 'V'))) {
            $cleanVer = substr($cleanVer, 1);
        }

        //Remove double spaces if any
        while (strpos($cleanVer, '  ') !== false) {
            $cleanVer = str_replace('  ', ' ', $cleanVer);
        }

        return trim($cleanVer);
    }
protected function cleanVersion($version)
    {
        //Clear anything that is in parentheses (and the parentheses themselves) - will clear started but unclosed ones too
        $cleanVer = preg_replace('/\([^)]+\)?/', '', $version);
        //Replace with a space any character which is NOT an alphanumeric, dot (.), hyphen (-), underscore (_) or space
        $cleanVer = preg_replace('/[^0-9.a-zA-Z_ -]/', ' ', $cleanVer);

        //Remove trailing and leading spaces
        $cleanVer = trim($cleanVer);

        //Remove trailing dot (.), hyphen (-), underscore (_)
        while (in_array(substr($cleanVer, -1), array('.', '-', '_'))) {
            $cleanVer = substr($cleanVer, 0, -1);
        }
        //Remove leading dot (.), hyphen (-), underscore (_) and character v
        while (in_array(substr($cleanVer, 0, 1), array('.', '-', '_', 'v', 'V'))) {
            $cleanVer = substr($cleanVer, 1);
        }

        //Remove double spaces if any
        while (strpos($cleanVer, '  ') !== false) {
            $cleanVer = str_replace('  ', ' ', $cleanVer);
        }

        return trim($cleanVer);
    }
protected function cleanVersion ( $ version ) { //Clear anything that is in parentheses (and the parentheses themselves) - will clear started but unclosed ones too $ cleanVer = preg_replace ( '/\([^)]+\)?/' , '' , $ version ) ; //Replace with a space any character which is NOT an alphanumeric, dot (.), hyphen (-), underscore (_) or space $ cleanVer = preg_replace ( '/[^0-9.a-zA-Z_ -]/' , ' ' , $ cleanVer ) ; //Remove trailing and leading spaces $ cleanVer = trim ( $ cleanVer ) ; //Remove trailing dot (.), hyphen (-), underscore (_) while ( in_array ( substr ( $ cleanVer , - 1 ) , array ( '.' , '-' , '_' ) ) ) { $ cleanVer = substr ( $ cleanVer , 0 , - 1 ) ; } //Remove leading dot (.), hyphen (-), underscore (_) and character v while ( in_array ( substr ( $ cleanVer , 0 , 1 ) , array ( '.' , '-' , '_' , 'v' , 'V' ) ) ) { $ cleanVer = substr ( $ cleanVer , 1 ) ; } //Remove double spaces if any while ( strpos ( $ cleanVer , '  ' ) !== false ) { $ cleanVer = str_replace ( '  ' , ' ' , $ cleanVer ) ; } return trim ( $ cleanVer ) ; }
Clean a version string from unwanted characters.
@access protected
@param string $version The version string to clean.
@return string Returns the cleaned version number string.
Clean a version string from unwanted characters .