public static function crossCheckIbanBic($iban, $bic)
    {
        // check for special cases
        if(in_array(strtoupper($bic), self::$exceptionalBics))
            return true;

        // remove whitespaces
        $iban = preg_replace('#\s+#','',$iban);
        $bic  = preg_replace('#\s+#','',$bic);

        // check the country code
        $ibanCountryCode = strtoupper(substr($iban,0,2));
        $bicCountryCode = strtoupper(substr($bic,4,2));

        if($ibanCountryCode === $bicCountryCode
            || (isset(self::$bicIbanCountryCodeExceptions[$ibanCountryCode])
                && in_array($bicCountryCode,self::$bicIbanCountryCodeExceptions[$ibanCountryCode])))
            return true;
        else
            return false;
    }
public static function crossCheckIbanBic($iban, $bic)
    {
        // check for special cases
        if(in_array(strtoupper($bic), self::$exceptionalBics))
            return true;

        // remove whitespaces
        $iban = preg_replace('#\s+#','',$iban);
        $bic  = preg_replace('#\s+#','',$bic);

        // check the country code
        $ibanCountryCode = strtoupper(substr($iban,0,2));
        $bicCountryCode = strtoupper(substr($bic,4,2));

        if($ibanCountryCode === $bicCountryCode
            || (isset(self::$bicIbanCountryCodeExceptions[$ibanCountryCode])
                && in_array($bicCountryCode,self::$bicIbanCountryCodeExceptions[$ibanCountryCode])))
            return true;
        else
            return false;
    }
public static function crossCheckIbanBic ( $ iban , $ bic ) { // check for special cases if ( in_array ( strtoupper ( $ bic ) , self :: $ exceptionalBics ) ) return true ; // remove whitespaces $ iban = preg_replace ( '#\s+#' , '' , $ iban ) ; $ bic = preg_replace ( '#\s+#' , '' , $ bic ) ; // check the country code $ ibanCountryCode = strtoupper ( substr ( $ iban , 0 , 2 ) ) ; $ bicCountryCode = strtoupper ( substr ( $ bic , 4 , 2 ) ) ; if ( $ ibanCountryCode === $ bicCountryCode || ( isset ( self :: $ bicIbanCountryCodeExceptions [ $ ibanCountryCode ] ) && in_array ( $ bicCountryCode , self :: $ bicIbanCountryCodeExceptions [ $ ibanCountryCode ] ) ) ) return true ; else return false ; }
Checks if IBAN and BIC belong to the same country. If not, they also can not belong to
each other.

@param string $iban
@param string $bic
@return bool
Checks if IBAN and BIC belong to the same country . If not they also can not belong to each other .