Skip to content

pl_kody ​

php
mixed pl_kody(string $kod , [string $kod2], [number $odleglosc])

Works with Polish postal codes. Accepts one to three arguments.

If only $kod is supplied, returns an array with these fields:

  • kod - postal code (the same as $kod);
  • miasto - town or city containing the post office with postal code $kod;
  • województwo - province containing the post office with postal code $kod;
If $kod2 is also supplied, returns the approximate distance in kilometres between the centres of the towns or cities containing the main post offices for the two postal codes.

If the third argument $odleglosc is supplied, returns true when that distance is less than or equal to $odleglosc, or false otherwise.

Always returns null if any postal code is missing from the database.

Example:

php
$kod = get_val('kod_pocztowy');

if (pl_kody($kod, '44-200', 100)) {
	ok();
} else {
	system_skipmessage();
}

Result:

In this example, messages are sent to recipients
who live within 100 km of the town with postal code 44-200.