Skip to content

Instantly share code, notes, and snippets.

@mlask
Created September 23, 2014 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlask/c174e6bf3e6b559e447d to your computer and use it in GitHub Desktop.
Save mlask/c174e6bf3e6b559e447d to your computer and use it in GitHub Desktop.
Weryfikacja numeru PWZ
<?php
function check_pwz_number ($number)
{
if (strlen($number) != 7 || preg_match('/^0+$/', $number)) return false;
$c = (int)$number[0];
$n = substr($number, 1);
$s = 0;
for ($i = 1; $i <= 6; $i ++) $s += (int)$n[$i - 1] * $i;
return ($s % 11) == $c ? true : false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment