Archive for the 'php' Category

php testfest

The PHP testfest 2009 is over, and a coffee mug just arrived in the mail. Finally my elePHPant can have some coffee as well! Thanks to php.no and redpill-linpro for arranging this years testfest.
php testfest 2009

If you are in Norway and need a job ( or maybe want to move to Norway ): in Fronter we need 4 new developers right now, so let me know if you are interested!

phpm

4 years ago I wrote a small program called phpm that I used for php function lookup when coding in vim. since then I’ve crossed over to ZendStudio and I’m now using that for my everyday work. But: every now and then I’ve had requests regarding phpm and if I can’t digg up the sources, and I’ve said: “sorry, but those are lost”. Until today: I went through a old HD, digging through backups and files: and suddenly phpm resurfaced!

So, today I can put the sources up here again if you still are interested. I’m not going to develop any further on it, so if someone wants to continue the development on it: please contact me on this blogpost.

The files:
* phpm
* the xml files – you need these too
* optional phpdocumentor template that will generate a xml file from your project

Remember that the xml files from the projects included in the xml package are old, and is there now only for a reference on how the program is set up. I’m not sure if the generate.php script will actually generate a correct php.xml file since there might have been changes in the documentation process the last 4 years.

I have tested the script out and it is still working, so there you go: a little new years present from my good old backup HD to you :) Let me know how it works out for you.

elePHPant

I got a elePHPant after the testfest, and just in time for a roadtrip to Stavanger ( 1000km roundtrip ), I went over with a car to move my sister and her boyfriend ( with all their stuff ) to Oslo. I brought the elePHPant with me and got some shots of it.
Read more »

RIP PHP4

With the release of 4.4.9 PHP4 is now officially dead. What can I say? Nothing much really: it should die silently and we’ll move along with PHP5/6 and be happy!

iterators

Today I’ll look at some iterators: a set of classes in the SPL that implements various iterating patterns: ArrayIterator, AppendIterator, FilterIterator, LimitIterator and NoRewindIterator. Hopefully you’ll get a idea of what these are capable of and that you can get some new ideas for your day-to-day tasks.
Read more »

Countable

Today I will look at the Countable interface, it has a single function that needs to be implemented: count(), by implementing this you can ensure that there is a count() function ready to use on any given class that implements it. The Countable interface is used in other places in the SPL as well: the ArrayIterator and ArrayObject classes implements this interface ( and SqliteResult if present )
Read more »

php testfest

Well, the testfest 2008 is wrapping up and a lot of the tests are now a part of the php distribution. php.no had a session where Hannes Magnusson introduced us to writing tests. I focused on some SPL areas that didn’t have coverage, and I got myself a elephant! ( check out the flickr group if you are unfamiliar with it)

The testfest is a great introduction to the internals of php and will teach you a lot when it comes to the behavior of the functionality you touch on, so next year: meet up at your local testfest and participate in getting the code coverage for php even higher ( or just digg into writing tests now! ).

SplObjectStorage

In this post I will look at SplObjectStorage: a container that allows to store objects uniquly without the need to compare them one by one.
Read more »

SplSubject

The SplObserver class, together with SplSubject, provides a interface for implementing the Observer pattern.
To quote wikipedia: The essence of this pattern is that one or more objects (called observers or listeners) are registered (or register themselves) to observe an event which may be raised by the observed object (the subject). (The object which may raise an event generally maintains a collection of the observers.)
Read more »

SplFileObject

PHP5.1 introduced a new file object, the SplFileObject, an object that can be used with any streams and implements RecursiveIterator & SeekableIterator for easy access to the stream iteself.

The documentation at php.net has the full API for the class, but to see how it behaves we will look at how this class can help us out with our day to day code.
Read more »