Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Generator numeru PESEL
Malinaa
post 28.01.2020, 15:54:13
Post #1





Grupa: Zarejestrowani
Postów: 573
Pomógł: 6
Dołączył: 21.07.2008

Ostrzeżenie: (0%)
-----


Usiłuję wykonać generator numeru PESEL KOD TUTAJ
Mam prośbę o sprawdzenie i poprawienie błędów.

Ten post edytował Malinaa 29.01.2020, 13:50:55


--------------------
I welcome you on the Internet >>> Design by Malina
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Malinaa
post 28.01.2020, 22:22:51
Post #2





Grupa: Zarejestrowani
Postów: 573
Pomógł: 6
Dołączył: 21.07.2008

Ostrzeżenie: (0%)
-----


Dziękuję bardzo. I kosmetyka została poprawiona.

Jest jeszcze fragment kodu... nie najlepszy.
Czy możemy ten fragment poprawić?

Kod
  // 10 digits number
  $fdigits = $lyear.$cmonth.$day.$rnumber.$sex;
  
  // Check digit
  $arrDigits = [9, 7, 3, 1, 9, 7, 3, 1, 9, 7];
  
  $number = (string)$fdigits;
  $strlen = strlen($number);
  $count = 0;
  for ($i=0; $i<$strlen; $i++) {
    $count = $count + ((int)$arrDigits[$i] * (int)$number[$i]);
    $count ++;
  }
  
  $control_number = substr(strstr($count/10, '.'), 1);
  if ($control_number == '') $control_number = 0;
  
  // PESEL
  $pesel = $fdigits.$control_number;



--------------------
I welcome you on the Internet >>> Design by Malina
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 22:01