note 48581 deleted from function.bcmod by nlopess

From: Date: Fri, 31 Dec 2004 10:35:26 +0000
Subject: note 48581 deleted from function.bcmod by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-82493@lists.php.net to get a copy of this message
Note Submitter: phil at NOSPAM dot blissnetworks dot net ---- Just some code that validates a ABN (Australian Business Number), uses modulus 89. Its pretty simple but may be handy for someone out there. <? //Validate an ABN public function validate_abn($abn){ $digit ; $sum ; $length = strlen($abn) ; $weighting = Array(10,1,3,5,7,9,11,13,15,17,19) ; for($i=0;$i<$length;$i++){ $digit = substr($abn,$i,1) ; if($i == 0){ $digit -= 1 ; } $sum += ($digit*$weighting[$i]) ; } if($sum % 89 == 0){ return TRUE ; } else{ return FALSE ; } } ?>

« previous php.notes (#82493) next »