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 »
Posts Categorized: PHP
PHP PDO Connection class
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;
Integrate Rails app and PHP on Apache
Here is one method of how to integrate a Ruby on Rails application and a PHP application or even just static HTML using Apache webserver. One reason for doing this could be (in this website’s case) that your main website application is Rails but you want to use WordPress or another technology of blog or… Read more »
My first job as a freelance web developer
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
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
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 »