Exemple #1
0
 /**
  * cutting pesel, day,month,year
  */
 public function __construct($pesel)
 {
     parent::__construct($pesel);
     $this->year = $this->cutPesel(0, 2);
     $this->month = $this->cutPesel(2, 2);
     $this->day = $this->cutPesel(4, 2);
 }
Exemple #2
0
 public function __construct($pesel)
 {
     parent::__construct($pesel);
     $this->gender = $this->cutPesel(9, 1);
 }
Exemple #3
0
    private function isCorrect()
    {
        if ($this->isDigit()) {
            $sum = 0;
            for ($i = 0; $i < 10; $i++) {
                $sum = $sum + $this->nrPeselDigit[$i] * $this->tabCorrect[$i];
            }
            if (!$sum % 10) {
                $sum = 0;
            } else {
                $sum = 10 - $sum % 10;
            }
            if ($sum == $this->nrPeselDigit[10]) {
                return true;
            } else {
                echo "Nieprawidlowy numer pesel.\n\n";
                return false;
            }
        }
    }
    public function show()
    {
        if ($this->setData()) {
            return "Plec: " . $this->sex . "\n" . "Data urodzenia: " . $this->year . " " . $this->tabMonath[$this->monath - 1] . " " . $this->day;
        } else {
            echo "Bledne dane.\n";
        }
    }
}
$pesel = new Pesel("74062109896");
echo $pesel->show();