Stumbling upon stuff

Been trolling the web in my free time at work (tests take a while to run) and stumbled upon a few interesting PHP projects.

First up is pecl/operator by Sara Golemon. It’s for PHP 5.1 only and there is no documentation yet but it provides a whole stack of magic functions for objects so that you can implement operator overloading for objects.

As an example check the following out:

1
2
3
4
5
6
7
8
class N {
    public function __add(N $x) {
        return new N();
    }
}
var_dump( $n1 = new N()   );  // object(N)#1
var_dump( $n2 = new N()   );  // object(N)#2
var_dump( $n3 = $n1 + $n2 );  // object(N)#3

Very cool with some seriously interesting possibilties. Of course due to the opinions of some of the core PHP developers it’s highly unlikly it’ll ever make it into the core, but who cares that’s what PECL is for.

Second is PHP-Gettext a completely native PHP implementation of GNU Gettext. Basically it means you can use Gettext translations without PHP being compiled against the Gettext library. Also neat things like using locales that aren’t installed on the server or using Gettext on Windows based hosts.


Leave a Reply

IMG_2225IMG_2213IMG_2209IMG_2202IMG_2199IMG_2196IMG_2188IMG_2180IMG_2177IMG_2174