Skip to content

Instantly share code, notes, and snippets.

View b3k's full-sized avatar

Bartosz Pietrzak b3k

  • CodeCargo
  • Poland
View GitHub Profile
@b3k
b3k / Sort.class.php
Created August 1, 2013 13:40
Multiple sort implementations in one class
<?php
class Sort {
public static function radix_sort($input) {
$min = min($input);
$max = max($input);
$temp = array_fill($min, $max - $min + 1, 0);
foreach ($input as $key => $val) {
$temp[$val]++;
}
@b3k
b3k / Pesel.class.php
Created April 18, 2012 14:49
Pesel Class - Class that extract data and validate PESEL number in object-oriented style
<?php
/**
* Class that validate and retrieve data from PESEL number in object-oriented style
*
* Example:
* $pesel = new Pesel('85042510356');
* $pesel->getBirthday()->format("d-m-Y")
* $pesel->getSex()
* $pesel->getAge("%a")