Implementing an Enum in PHP

Posted by & filed under PHP, Programming.

A quick PHP example; how to implement an ‘kindof’ Enum. PHP lacks this useful feature so this is a bit of a hack to emulate one, it doesn’t quite get there but could do a job. This isn’t the only way to to do this but it’s good to namespace and contain your properties in… Read more »

PHP PDO Connection class

Posted by & filed under PHP, Programming.

A useful, perhaps, class for database connections using the PHP PDO library: PDOConnection.php   Singleton implementation with the class method getConnection() returning a \PDO connection with connection details;        

My first job as a freelance web developer

Posted by & filed under PHP, Programming, Web.

I recently took my first steps as a freelance web developer; actually these were less steps but rather poking a foot in to test the water. I found it neither too hot to handle, nor too cold for comfort (luke warm I suppose you call it) but all the same exciting and addictive. I must… Read more »

Get string of boolean value in PHP

Posted by & filed under PHP, Programming.

PHP has the function string strval($var) to return a string value from the variable which is great but the string value of a boolean is either 1 or 0 so this will not return the string “true” or “false”. This simple little example and function shows this and is great for a project I’ve just… Read more »

PHP Table from XML doc

Posted by & filed under PHP, Programming.

This has probably been done before and probably in a better way but I was quite pleased with doing this myself. This PHP code will build and fill a table with the contents of your XML file.   “; echo “”; echo “COL1″; echo “COL2″; echo “COL3″; echo “COL4″; //Initialises the XML parser $xmlparser=xml_parser_create(); //Picks… Read more »