All pastes #950619 Raw Edit

Unnamed

public php v1 · immutable
·published 2008-03-20 18:37 UTC
rendered paste body
private function validateNip($nip){	    	  $n = str_replace(array('-', ' '), '', $nip);  	    	  if(strlen($n) !== 10)  	     return false;  	        $weights = array(6, 5, 7, 2, 3, 4, 5, 6, 7);      $sum = 0;      foreach($weights as $i => $w)      {        $sum += intval($n{$i}) * $w;      }            return (($sum % 11) == 10 ? false : true);}