• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP verify_iban函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中verify_iban函数的典型用法代码示例。如果您正苦于以下问题:PHP verify_iban函数的具体用法?PHP verify_iban怎么用?PHP verify_iban使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了verify_iban函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: VerifyMachineFormatOnly

 public function VerifyMachineFormatOnly($iban = '')
 {
     if ($iban != '') {
         return verify_iban($iban, true);
     }
     return verify_iban($this->iban, true);
 }
开发者ID:globalcitizen,项目名称:php-iban,代码行数:7,代码来源:oophp-iban.php


示例2: verify_and_format_iban

function verify_and_format_iban($IBAN)
{
    if (!verify_iban($IBAN)) {
        throw new Exception("IBAN {$IBAN} is ongeldig");
    }
    return iban_to_machine_format($IBAN);
}
开发者ID:rsnel,项目名称:au3,代码行数:7,代码来源:maak_xml.php


示例3: buildIban

 private function buildIban($controlNumber, $bban)
 {
     $iban = $this->country . $controlNumber . $bban;
     if (!verify_iban($iban)) {
         throw new IbanConvertorException("Iban is in invalid format");
     }
     return $iban;
 }
开发者ID:bladerik,项目名称:php-iban-convertor,代码行数:8,代码来源:IbanConvertor.php


示例4: verifyIBAN

 /**
  * Verifies if the given IBAN is formally correct
  *
  * @param iban  string, IBAN candidate
  *
  * @return NULL if given IBAN is valid, localized error message otherwise
  */
 static function verifyIBAN($iban)
 {
     // We only accept uppecase characters and numerals (machine format)
     // see https://github.com/Project60/org.project60.sepa/issues/246
     if (!preg_match("/^[A-Z0-9]+\$/", $iban)) {
         return ts("IBAN is not correct");
     }
     if (verify_iban($iban)) {
         return NULL;
     } else {
         return ts("IBAN is not correct");
     }
 }
开发者ID:FundingWorks,项目名称:org.project60.sepa,代码行数:20,代码来源:Verification.php


示例5: Verify

 public function Verify($iban = '')
 {
     if ($iban != '') {
         return verify_iban($iban);
     }
     return verify_iban($this->iban);
     # we could throw exceptions of various types, but why - does it really
     # add anything? possibly some slightly better user feedback potential.
     # however, this can be written by hand by performing individual checks
     # ala the code in verify_iban() itself where required, which is likely
     # almost never. for the increased complexity and
     # maintenance/documentation cost, i say, therefore: no. no exceptions.
 }
开发者ID:brittoavr,项目名称:php-iban,代码行数:13,代码来源:oophp-iban.php


示例6: check_IBAN

function check_IBAN($iban)
{
    $machine_iban = iban_to_machine_format($iban);
    if (verify_iban($machine_iban)) {
        $array['result'] = false;
        $array['human_IBAN'] = iban_to_human_format($machine_iban);
        echo json_encode($array);
    } else {
        $array['result'] = true;
        $array['message'] = "Nesprávny iban";
        echo json_encode($array);
    }
}
开发者ID:centaurustech,项目名称:Funduj,代码行数:13,代码来源:functions.php


示例7: iban_to_human_format

function iban_to_human_format($iban)
{
    # First verify validity, or return
    if (!verify_iban($iban)) {
        return false;
    }
    # Add spaces every four characters
    $tr = '';
    for ($i = 0; $i < strlen($iban); $i++) {
        $tr .= substr($iban, $i, 1);
        if ($i > 0 && ($i + 1) % 4 == 0) {
            $tr .= ' ';
        }
    }
    return $tr;
}
开发者ID:brittoavr,项目名称:php-iban,代码行数:16,代码来源:php-iban.php


示例8: validateForm

 public function validateForm(array &$element, array &$form_state, \Payment $payment)
 {
     $values =& \Drupal\Component\Utility\NestedArray::getValue($form_state['values'], $element['#parents']);
     $method_data =& $payment->method_data;
     $method_data['holder'] = $values['holder'];
     if (empty($values['holder']) == TRUE) {
         form_error($element['holder'], t('Please enter the name of the account holder.'));
     }
     $method_data['iban'] = trim($values['ibanbic']['iban']);
     $method_data['bic'] = trim($values['ibanbic']['bic']);
     $method_data['country'] = substr($method_data['iban'], 0, 2);
     require_once dirname(__FILE__) . '/../php-iban.php';
     if (verify_iban($method_data['iban']) == FALSE) {
         form_error($element['ibanbic']['iban'], t('Please enter a valid IBAN.'));
     }
     if (preg_match('/^[a-z]{6}[2-9a-z][0-9a-np-z](|xxx|[0-9a-wyz][0-9a-z]{2})$/i', $method_data['bic']) != 1) {
         form_error($element['ibanbic']['bic'], t('Please enter a valid BIC.'));
     }
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:19,代码来源:AccountForm.php


示例9: ini_set

<?php

# additional tests library
#  - first we enable error display
ini_set('display_errors', 1);
#  - next we ensure that all errors are displayed
ini_set('error_reporting', E_ALL);
# include the library itself
require_once dirname(dirname(__FILE__)) . '/php-iban.php';
print "Other tests:\n";
# === verify_iban machine_format_only mode ===============================
$test_data = array(array('GB29 NWBK 6016 1331 9268 19', true, false), array('GB29 NWBK 6016 1331 9268 19', false, true), array('IBAN GB29-NWBK-6016-1331-9268 19', true, false), array('IBAN GB29-NWBK-6016-1331-9268 19', false, true), array('IIBAN GB29-NWBK-6016-1331-9268 19', false, true));
$i = 0;
foreach ($test_data as $this_test) {
    print " - verify_iban() test #{$i}... ";
    if (verify_iban($this_test[0], $this_test[1]) !== $this_test[2]) {
        print "FAILED.\n";
        exit(1);
    } else {
        print "OK.\n";
    }
    $i++;
}
# === swift_official field ===================================
print " - SWIFT official check for 'AA'... ";
if (iban_country_get_country_swift_official('AA')) {
    print "FAILED.\n";
    exit(1);
} else {
    print "OK.\n";
}
开发者ID:gaetan-be,项目名称:php-iban,代码行数:31,代码来源:other-tests.php


示例10: checkIBAN

 /**
  * @param $value
  * @return bool
  */
 public function checkIBAN($value)
 {
     return verify_iban($value);
 }
开发者ID:kervala,项目名称:php-sepa-xml-generator,代码行数:8,代码来源:ValidationRules.php


示例11: usage

if (!isset($argv[1]) || $argv[1] == '-h' || $argv[1] == '--help') {
    usage();
}
$list_file = $argv[1];
$errors = 0;
if (!($raw_list = file_get_contents($list_file))) {
    print "Error opening list file '{$list_file}'.\n";
    exit(1);
}
$list = preg_split("/[\r\n]+/", $raw_list);
$results = array();
foreach ($list as $iban) {
    if ($iban != '') {
        # let's check it
        print $iban . " ... ";
        if (!verify_iban($iban)) {
            print "FAILED";
            ########## try to provide better output #############
            $iban = iban_to_machine_format($iban);
            $country = iban_get_country_part($iban);
            $observed_length = strlen($iban);
            $expected_length = iban_country_get_iban_length($country);
            if ($observed_length != $expected_length) {
                print " (length {$observed_length} does not match expected length {$expected_length} for country {$country})";
            }
            $checksum = iban_get_checksum_part($iban);
            if (!iban_verify_checksum($iban)) {
                print " (checksum {$checksum} invalid)";
            }
            $regex = '/' . iban_country_get_iban_format_regex($country) . '/';
            if (!preg_match($regex, $iban)) {
开发者ID:globalcitizen,项目名称:php-iban,代码行数:31,代码来源:validate-list.php


示例12: iban_to_human_format

    print "Is a SEPA member? ";
    if (iban_country_is_sepa($countrycode)) {
        print "Yes";
    } else {
        print "No";
    }
    print ".\n";
    # get example iban
    $iban = $country['iban_example'];
    # output example iban properties one by one
    print "Example IBAN: " . iban_to_human_format($iban) . "\n";
    print " - country  " . iban_get_country_part($iban) . "\n";
    print " - checksum " . iban_get_checksum_part($iban) . "\n";
    print " - bban     " . iban_get_bban_part($iban) . "\n";
    print " - bank     " . iban_get_bank_part($iban) . "\n";
    print " - branch   " . iban_get_branch_part($iban) . "\n";
    print " - account  " . iban_get_account_part($iban) . "\n";
    # output all properties
    #$parts = iban_get_parts($iban);
    #print_r($parts);
    # verify
    print "\nChecking validity... ";
    if (verify_iban($iban)) {
        print "IBAN {$iban} is valid.\n";
    } else {
        print "ERROR: IBAN {$iban} is invalid.\n";
        $errors++;
    }
    print "\n";
}
exit($errors);
开发者ID:brittoavr,项目名称:php-iban,代码行数:31,代码来源:test.php


示例13: iban_mistranscription_suggestions

function iban_mistranscription_suggestions($incorrect_iban)
{
    # abort on ridiculous length input (but be liberal)
    $length = strlen($incorrect_iban);
    if ($length < 5 || $length > 34) {
        return array('(supplied iban length insane)');
    }
    # abort if mistranscriptions data is unable to load
    if (!_iban_load_mistranscriptions()) {
        return array('(failed to load mistranscriptions)');
    }
    # init
    global $_iban_mistranscriptions;
    $suggestions = array();
    # we have a string of approximately IBAN-like length.
    # ... now let's make suggestions.
    $numbers = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
    for ($i = 0; $i < $length; $i++) {
        # get the character at this position
        $character = substr($incorrect_iban, $i, 1);
        # for each known transcription error resulting in this character
        foreach ($_iban_mistranscriptions[$character] as $possible_origin) {
            # if we're:
            #  - in the first 2 characters (country) and the possible replacement
            #    is a letter
            #  - in the 3rd or 4th characters (checksum) and the possible
            #    replacement is a number
            #  - later in the string
            if ($i < 2 && !in_array($possible_origin, $numbers) || $i >= 2 && $i <= 3 && in_array($possible_origin, $numbers) || $i > 3) {
                # construct a possible IBAN using this possible origin for the
                # mistranscribed character, replaced at this position only
                $possible_iban = substr($incorrect_iban, 0, $i) . $possible_origin . substr($incorrect_iban, $i + 1);
                # if the checksum passes, return it as a possibility
                if (verify_iban($possible_iban)) {
                    array_push($suggestions, $possible_iban);
                }
            }
        }
    }
    # now we check for the type of mistransposition case where all of
    # the characters of a certain type within a string were mistransposed.
    #  - first generate a character frequency table
    $char_freqs = array();
    for ($i = 0; $i < strlen($incorrect_iban); $i++) {
        if (!isset($char_freqs[substr($incorrect_iban, $i, 1)])) {
            $char_freqs[substr($incorrect_iban, $i, 1)] = 1;
        } else {
            $char_freqs[substr($incorrect_iban, $i, 1)]++;
        }
    }
    #  - now, for each of the characters in the string...
    foreach ($char_freqs as $char => $freq) {
        # if the character occurs more than once
        if ($freq > 1) {
            # check the 'all occurrences of <char> were mistranscribed' case
            foreach ($_iban_mistranscriptions[$char] as $possible_origin) {
                $possible_iban = str_replace($char, $possible_origin, $incorrect_iban);
                if (verify_iban($possible_iban)) {
                    array_push($suggestions, $possible_iban);
                }
            }
        }
    }
    return $suggestions;
}
开发者ID:gitter-badger,项目名称:php-iban,代码行数:65,代码来源:php-iban.php


示例14: isValid

 public function isValid($value)
 {
     $sanitized = preg_replace('/\\s/', '', $value);
     return verify_iban($sanitized, true);
 }
开发者ID:jmversteeg,项目名称:fieldwork,代码行数:5,代码来源:IbanFieldValidator.php


示例15: normalise

 /**
  * Normalise a reference (if a normalisation is available)
  *
  * @param $reference_type_name the name of the type, e.g. IBAN, NBAN_DE, ...
  *
  * @return  FALSE if no normalisation is possible (not implemented)
  *          0     if doesn't comply with standard 
  *          1     if reference is already normalised
  *          2     if reference was normalised
  */
 public static function normalise($reference_type_name, &$reference)
 {
     $match = array();
     switch ($reference_type_name) {
         case 'IBAN':
             $structure_correct = self::std_normalisation($reference_type_name, $reference, "#^(?P<IBAN>[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{4}[0-9]{7}([a-zA-Z0-9]?){0,16})\$#", "%s");
             if (!$structure_correct) {
                 return $structure_correct;
             } else {
                 // structure correct, check the checksum...
                 if (TRUE == (include 'packages/php-iban-1.4.0/php-iban.php') && function_exists('verify_iban')) {
                     if (verify_iban($reference)) {
                         return $structure_correct;
                     } else {
                         return 0;
                     }
                 } else {
                     // this means we cannot check beyond structural compliance...
                     //   ...but what can we do?
                     return $structure_correct;
                 }
             }
             return FALSE;
             // we shouldn't get here
         // we shouldn't get here
         case 'NBAN_DE':
             return self::std_normalisation($reference_type_name, $reference, "#^(?P<BLZ>\\d{8})/(?P<KTO>\\d{2,10})\$#", "%08d/%010d");
         case 'NBAN_CH':
             return self::std_normalisation($reference_type_name, $reference, "#^(?P<PRE>\\d{1,2})-(?P<KTO>\\d{2,9})-(?P<SUF>\\d{1})\$#", "%02d-%09d-%01d");
         case 'NBAN_CZ':
             // first, try with prefix
             $result = self::std_normalisation($reference_type_name, $reference, "#^(?P<PREFIX>\\d{1,6})-(?P<ACCT>\\d{1,10})/(?P<BANK>\\d{1,4})\$#", "%06d-%010d/%04d");
             if ($result) {
                 return $result;
             } else {
                 // if failed, try with shortened form (no prefix)
                 return self::std_normalisation($reference_type_name, $reference, "#^(?P<ACCT>\\d{1,10})/(?P<BANK>\\d{1,4})\$#", "%010d/%04d");
             }
         default:
             // not implemented
             return FALSE;
     }
 }
开发者ID:VangelisP,项目名称:org.project60.banking,代码行数:53,代码来源:BankAccountReference.php



注:本文中的verify_iban函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP verify_id函数代码示例发布时间:2022-05-23
下一篇:
PHP verify_forum_password函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap