Since I was recently asked whether it’s possible to overload constructors in PHP, or functions in general, here is the quick answer: No, not in the common sense of “overloading”, i.e. creating multiple versions of the same function name with different implementations and arguments. Thus, the following is not possible by default in PHP: Pattern-based […]
This post is an addition to Enabling Cross-Origin Resource Sharing CORS for Apache to show you how to enable Cross-Origin Resource Sharing CORS for PHP. Thus, in case you don’t have access to the .htaccess you can simply enable CORS for PHP using the following steps. Setting required headers using PHP As explained in Enabling […]
Today, version 1.9.0 of PHP Mailing List was released. Due to numerous requests it is now possible to reply to message directly using the reply link attached to messages. In addition, numerous smaller code improvements have been applied. Feel free to download the latest version via GitHub.
In a recent Magento setup with a Varnish caching server an undefined PHP variable in a template resulted in the error message “ESI processing not enabled“. Due to the undefined PHP variable the underlying Varnish caching server’s Edge-side includes (ESI) capabilities, allowing content assembly by HTTP surrogates through in-markup XML-based language failed. After a quick […]
KeePass and KeePassX are almost perfect tools when it comes to storing passwords and other sensitive information. Almost, since these tools currently only work offline and do not expose command line options out of the box. Since I want to access certain information on the road I was searching for ways to access KeePass and […]
Continuous integration for PHP projects oftentimes exist of merely running your latest test cases against PHPUnit and on success uploading your new file versions to your staging (or even production) server. Although Jenkins is able to handle all those tasks (easily) the way along numerous configuration steps can be quite painful. With PHPCI a new […]
Operating interational websites and portals naturally requires multilanguage support and localization. Especially more prominent frameworks provide i18n support right out of the box. One of these is Silverstripe which recently has been released in version 3. This brief article describes the steps required to activate multilanguage support in Silverstripe. First of all, you need to […]
Today, there already exist numerous URL shortening services, such as tinyurl, bit.ly, qr.cx and many more. Although they are very handy when it comes to shortening URLs in blog posts and articles oftentimes they can’t be used in proprietary software due to certain copyright and usage restrictions. Thus, a vast range of projects have evolved […]
Unfortunately, the Zend Framework (ZF) version 1.x currently does not provide a standard way or class to implement multi-page forms based on Zend_Form. Due to the fact that this is a very common use case I will try to explain a working solution to overcome this problem. Basically, the goal is to provide means to […]
The following function presents a simple approach to convert PHP arrays to their XML counterpart. It supports nested arrays too. Internally, it uses SimpleXMLElement to do the actual work. Examples are: which produces:
As there currently does not exist a PHP function that allows developers to delete or copy entire (non-empty) directories at once one has to recursively loop through them to manually delete/copy their contents. This post provides you with two easy to use functions for deleting entire (non-empty) directories copying entire (non-empty) directories First, let’s start […]
Sometimes it is necessary to determine the next auto-increment value that will be used by MySQL for inserting values into tables. First off, there are several different approaches to determine it. Most people use the MAX() function and simply add 1 to the value. Although this is fine is most cases, you may run into […]
For a project I am currently working on it was necessary to read PHP define()’d-values from a configuration file using a shell script that did some further processing. In order to be able to read define()’d-values you need to first include() (or better require_once()) the source configuration file(s) and then assign its values to shell […]
A simple mailing list manager written in PHP. Using PHP Mailing List you can easily set up mailing lists with unlimited number of users. Messages can be sent using the web interface and will be broadcasted by PHP Mailing List to all list members. Members can be added/removed from lists via the web interface too. […]
This PHP script parses “useful” information from HTML tables. It has been developed as an additional tool in the course of my master thesis at the Graz University of Technology. Please refer to my master thesis for detailed information on this tool.