Ik probeer tegevrees een formulier te maken waarbij het opgegeven btw-nummer gecontroleerd wordt op volgende parameters schrijfwijze
heb dit geprobeerd maar niet echt succesvol
<?php
/**
* controle btw nummer
* controle op formaat en landcode
*controle belgische nummers
*invoercontrole op punt na
* controle op belgische landcode (KAN DIT INDIEN OOK ANDER LANDODES WORDEN INGEGEVEN?)
* controle op aantal nummers 9 of 10 indien eerste 0 is


*uitkomst zou boolion zijn
*/
function isBTW($btwingave)
{
$btwingave = trim($btwingave);
$btwingave = str_replace('.', '', $btwingave);
$ = array();

//eerste controle
if (!preg_match('/^([a-z]{2})[ ]*(.+)$/is', $btwingave, $controleformaat))
{
return false;
}

$controleformaat[1] = strtoupper($controleformaat[1]);
$landcodes = array(
'AT' => 'U[0-9]{8}',
'BE' => '0[0-9]{9}',
'BG' => '[0-9]{9,10}',
'CY' => '[0-9]{8}[A-Za-z]',
'CZ' => '[0-9]{8,10}',
'DE' => '[0-9]{9}',
'DK' => '[0-9]{2} ?[0-9]{2} ?[0-9]{2} ?[0-9]{2}',
'EE' => '[0-9]{9}',
'EL' => '[0-9]{9}',
'ES' => '([A-Za-z0-9][0-9]{7}[A-Za-z0-9])',
'FI' => '[0-9]{8}',
'FR' => '[A-Za-z0-9]{2} ?[0-9]{9}',
'GB' => '([0-9]{3} ?[0-9]{4} ?[0-9]{2}|[0-9]{3} ?[0-9]{4} ?[0-9]{2} ?[0-9]{3}|GD[0-9]{3}|HA[0-9]{3})',
'HU' => '[0-8]{8}',
'IE' => '[0-9][A-Za-z0-9+*][0-9]{5}[A-Za-z]',
'IT' => '[0-9]{11}',
'LT' => '([0-9]{9}|[0-9]{12})',
'LU' => '[0-9]{8}',
'LV' => '[0-9]{11}',
'MT' => '[0-9]{8}',
'NL' => '[0-9]{9}B[0-9]{2}',
'PL' => '[0-9]{10}',
'PT' => '[0-9]{9}',
'RO' => '[0-9]{2,10}',
'SE' => '[0-9]{12}',
'SI' => '[0-9]{8}',
'SK' => '[0-9]{10}',
);

if (!isset($landcodes[$controleformaat[1]]) || !preg_match('/^([a-z]{2})[ ]*'.$landcodes[$controleformaat[1]].'$/is', $btwingave))
{
return false;
}

return true;
}
//TWEEDE CONTROLE ALLEEN OP BELGIE
function $belgischbtwnummer($btwingave)
{

$resultaat1 = str_replace(array(' ', '.'),'',($btwingave));

if(preg_match('#^BE0?[0-9]{9}$#i', $resultaat1))
{
$resultaat2 = str_ireplace('BE','', $resultaat1);

$controle = 97 - (floor($iVatnr / 100) % 97) ==$resultaat2 % 100;
}
else
{
$controle = false;
}
return $controle;
}
?>
?>
Roep je de functie aan?
dacht het wel maar denk dat probleem zit in het ontbreken van controles op juist heid andere landen maar ben hier echt niet goed in :-(
Hoe roep je de functie nu aan?

Reageren