Tagged: PHP

PHP Logo 1

Overloading constructors and functions in PHP

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...

Source Code Icon 4

Enabling Cross-Origin Resource Sharing CORS for PHP

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 Logo 0

PHP Mailing List – Version 1.9.0 Released

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.

Magento Logo 0

Magento Error ESI processing not enabled

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...

Web-based KeePass(X) Management Tool 6

Web-based KeePass(X) Management Tool

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...

Silverstripe Logo 0

Multilanguage support in Silverstripe

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...

Source Code Icon 21

Shortening Strings (URLs) using Base 62 Encoding

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...

Mehrseitige Formulare mittels Zend Framework umsetzenImplementing multi-page forms using the Zend Framework 40

Mehrseitige Formulare mittels Zend Framework umsetzenImplementing multi-page forms using the Zend Framework

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...

PHP Logo 4

PHP – Array to XML Conversion

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:

PHP Logo 6

Delete/copy directories recursively using PHP

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...

Calculate next auto-increment value for MySQL tables 1

Calculate next auto-increment value for MySQL tables

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...

Google Logo 2

Assigning PHP variables in shell

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...

PHP Mailing List 6

PHP Mailing List

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...

Source Code Icon 0

HTML Table Extractor

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.