Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function Controle($NumeroTrain)
- {
- $while = 0;
- $ARRAY = str_split($NumeroTrain);
- $result = 0;
- $while = 0;
- $arraycount = count($ARRAY);
- $arrayget = 0;
- $array1 = 1;
- while ($arraycount != $while)
- {
- $while++;
- if ( $array1 & 1 )
- {
- $two = $ARRAY[$arrayget];
- $two = 2*$two;
- if ( $two >= 10)
- {
- $two = $two-9;
- }
- $result = $result+$two;
- echo "<br>REs : $result</br>";
- }
- else
- {
- $one = $ARRAY[$arrayget];
- $result = $result+$one;
- echo "<br>REs : $result</br>";
- }
- $arrayget++;
- $array1++;
- }
- $arraytotal = ceil($result/10)*10;
- $result = $arraytotal-$result;
- return $result;
- }
- $NumeroTrain = '51800843004';
- $result = Controle($NumeroTrain);
- echo $result;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement