PHP normalize function

I post my normalization function. This function find all illegal characters (like: Ő, Ű, ú, í, etc. ) and replace it to latin1 chars. (like: O, U, u, i, etc.) This function works for me on hungarian words. Try it on your text and post your comment about it.

HTML number formatting with PHP

Here is my HTML number formatter. Sometimes the browsers wrap the numbers along thousand separator or decimal pont, but this function prevents this event.

function html_number_format($number, $decimals = 2, $dec_point = '.', $thousands_sep = ',') {
  if ($number === FALSE) {
    return '---';
  return '<span style="white-space: nowrap;">'.number_format($number, $decimals, $dec_point, $thousands_sep).'</span>';

Install Drupal7 with PostgreSQL

I've downloaded Drupal 7 (alpha 6) and installed it on my server. Now I'm writing about my experience.

Installation process issuses:
* If you want to install Drupal on pgSql schema then you have to install it the default public schema and after it you may rename the public schema from public to "your_schema_name".

How can you generate thumbnail with php?

You can read about two popular thumbnail generating methods in this article. The first method requires GD library. If you select the other way you need Imagick which is a native php extension to create and modify images using the ImageMagick API. Let's see the code!

PHP GD2 vs Imagick



function gd_thumbnail($filename, $width = 200, $height = 200) {
$source = imageCreateFromString(file_get_contents($filename));
$x = imageSX($source);
$y = imageSY($source);

if ($x > $y) { // landscape orientation
$height = intval($y/($x/$width));
} else { // square or portrait orientation
$width = intval($x/($y/$height));

$destination = ImageCreateTrueColor($width,$height);

PHP: How to get public properties of object

Sometimes you need all public properties of an object. I've also met this problem. I tried to find some usable native function on php.net, but the only native solution is the ReflectionProperty class. I think It claims too much resource. I've written an own function that has solved this issue.

Let's see the function

* It gets all public properties of given $object.
* @param object $object It must be object.
* @return array that contains all public property name as key and their values. example:

Blog categories:  Web development

Bitprison CAPTCHA System for PHP

I've made a CAPTCHA system what is ease of use for any PHP website. This is a full object oriented class library. Ease of use and ease of customisation. Try it! Feel free to download and use it. Please leave a comment.


  • Very minimal software requirements
  • Ease of customisation (parameters or class extending)
  • Full object oriented library
  • One file one class
Blog categories:  Programming

Easy colour syntax highlighting on webpage

Publish your source code on web with colour syntax highlighting.

For example: How to send correct UTF-8 mail in PHP
This article is contain a PHP code what is syntax highlighted and all PHP function is link to PHP documentation. This code is more understandable, and more readable than simple colourless version.

How to set syntax highlighting on your website?