File: sample_multiple.php

package info (click to toggle)
php-validate 0.8.5-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 244 kB
  • ctags: 352
  • sloc: php: 758; xml: 492; makefile: 2
file content (55 lines) | stat: -rw-r--r-- 1,863 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
//include_once "Validate/FR.php";
require_once "/usr/share/php/Validate.php";
/*
test(Validate::creditCard('6762195515061813'), true);
// 4
test(Validate::creditCard('6762195515061814'), false);
// 5
*/
/*
function rib($aCodeBanque, $aCodeGuichet='', $aNoCompte='', $aKey='')
function number($number, $decimal = null, $dec_prec = null, $min = null, $max = null)
*/
$values = array(
    'amount'=> '13234,344343',
    'name'  => 'foo@example.com',
    'rib'   => array(
                'codebanque'   => '33287',
                'codeguichet'  => '00081',
                'nocompte'     => '00923458141C',
                'key'          => '52'
                ),
    'rib2'  => array(
                'codebanque'   => '12345',
                'codeguichet'  => '12345',
                'nocompte'     => '12345678901',
                'key'          => '46'
                ),
    'cc'    => '6762195515061813',
    'cc2'   => '6762195515061814',
    'mail'  => 'foo@example.com',
    'hissiret' => '441 751 245 00016',
    'mystring' => 'ABCDEabcde',
    'iban'  => 'CH10002300A1023502601',
    'cep'   => '12345-123'
    );
$opts = array(
    'amount'=> array('type'=>'number','decimal'=>',.','dec_prec'=>null,'min'=>1,'max'=>32000),
    'name'  => array('type'=>'email','check_domain'=>false),
    //'rib'   => array('type'=>'FR_rib'),
    //'rib2'  => array('type'=>'FR_rib'),
    //'cc'    => array('type'=>'Finance_CreditCard_number'),
    //'cc2'   => array('type'=>'Finance_CreditCard_number'),
    'mail'  => array('type'=>'email'),
    //'hissiret' => array('type'=>'FR_siret'),
    'mystring' => array('type'=>'string',array('format'=>VALIDATE_ALPHA, 'min_length'=>3)),
    //'iban'  => array('type'=>'Finance_iban'),
    //'cep'   => array('type'=>'ptBR_postalcode')
    );

$result = Validate::multiple($values, $opts);

print_r($result);

?>