From http://strims.pl/s/PHP/tb/iib9nd/10-php-snippets-for-developers-code-geekz