public static function checkIBAN($iban, $options = null)
    {
        $iban = preg_replace('/\s+/u', '' , $iban );     // remove whitespaces
        $iban = strtoupper($iban);

        if(!preg_match('/^' . self::PATTERN_IBAN . '$/',$iban))
            return false;

        $ibanCopy = $iban;

        if(!isset($options['checkByFormat']) || $options['checkByFormat'])
        {
            $countryCode = substr($iban,0,2);
            if(isset(self::$ibanPatterns[$countryCode])
                && !preg_match('/^' . self::$ibanPatterns[$countryCode] . '$/',$iban))
                return false;
        }

        if(!isset($options['checkByCheckSum']) || $options['checkByCheckSum'])
        {
            $iban = $check = str_replace(self::$alphabet, self::$alphabetValues, $iban);

            $bban  = substr($iban, 6);
            $check = substr($iban, 0, 6);

            $concat = $bban . $check;

            if( !self::iso7064Mod97m10ChecksumCheck($concat) )
                return false;
        }

        return $ibanCopy;
    }
public static function checkIBAN($iban, $options = null)
    {
        $iban = preg_replace('/\s+/u', '' , $iban );     // remove whitespaces
        $iban = strtoupper($iban);

        if(!preg_match('/^' . self::PATTERN_IBAN . '$/',$iban))
            return false;

        $ibanCopy = $iban;

        if(!isset($options['checkByFormat']) || $options['checkByFormat'])
        {
            $countryCode = substr($iban,0,2);
            if(isset(self::$ibanPatterns[$countryCode])
                && !preg_match('/^' . self::$ibanPatterns[$countryCode] . '$/',$iban))
                return false;
        }

        if(!isset($options['checkByCheckSum']) || $options['checkByCheckSum'])
        {
            $iban = $check = str_replace(self::$alphabet, self::$alphabetValues, $iban);

            $bban  = substr($iban, 6);
            $check = substr($iban, 0, 6);

            $concat = $bban . $check;

            if( !self::iso7064Mod97m10ChecksumCheck($concat) )
                return false;
        }

        return $ibanCopy;
    }
public static function checkIBAN ( $ iban , $ options = null ) { $ iban = preg_replace ( '/\s+/u' , '' , $ iban ) ; // remove whitespaces $ iban = strtoupper ( $ iban ) ; if ( ! preg_match ( '/^' . self :: PATTERN_IBAN . '$/' , $ iban ) ) return false ; $ ibanCopy = $ iban ; if ( ! isset ( $ options [ 'checkByFormat' ] ) || $ options [ 'checkByFormat' ] ) { $ countryCode = substr ( $ iban , 0 , 2 ) ; if ( isset ( self :: $ ibanPatterns [ $ countryCode ] ) && ! preg_match ( '/^' . self :: $ ibanPatterns [ $ countryCode ] . '$/' , $ iban ) ) return false ; } if ( ! isset ( $ options [ 'checkByCheckSum' ] ) || $ options [ 'checkByCheckSum' ] ) { $ iban = $ check = str_replace ( self :: $ alphabet , self :: $ alphabetValues , $ iban ) ; $ bban = substr ( $ iban , 6 ) ; $ check = substr ( $ iban , 0 , 6 ) ; $ concat = $ bban . $ check ; if ( ! self :: iso7064Mod97m10ChecksumCheck ( $ concat ) ) return false ; } return $ ibanCopy ; }
Checks if an iban is valid. Note that also if the iban is valid it does not have to exist

@param string $iban
@param array  $options valid keys:
- checkByCheckSum (boolean): If true, the IBAN checksum is
calculated (default:true)
- checkByFormat (boolean): If true, the format is checked by
regular expression (default: true)
@return string|false The valid iban or false if it is not valid
Checks if an iban is valid . Note that also if the iban is valid it does not have to exist