Finding bottlenecks in your PHP code

Frequently one finds that some piece of webpage code is slowing down pageload time. Although there are many PHP libraries that one can use to benchmark the code to find bottlenecks, most of the time a quick solution is usually enough. Usually xdebug is used, but many times it is not installed on servers. The current post show a simple way to find bottlenecks in your PHP code.
Read More

Test dependencies in PHPUnit 3.4

PHPUnit has become the de-facto standard for unit testing PHP code. Now in version 3.4, it has added many new and interesting features to its repertoire.

Dependencies in PHPUnit tests

PHPUnit 3.4 now supports dependencies between different test methods. It allows you to execute a particular test ONLY IF the test that it depends on executes successfully. Take the following example (Listing 1.) where we test a linked-list class I developed earlier.
Read More

Detecting duplicate code in PHP files

Duplicated code in projects is a frequent thing and also the one ripe for factoring out in a new class or function. Cut/Paste coding is a common development practice among programmers, a lot of which can lead to code size increase and maintenance nightmares. PHPCPD (php copy paste detector) is a PEAR tool that makes it easier to detect duplicate code in php projects. Below is a short tutorial on the PHPCPD package.
Read More

Generating test data for MySQL

The most common type of web application a developer encounters are database related. But rarely is the case when you have the required data in your database during testing, making it a frequent source of frustration for programmers, who than have to manually populate the database. Having a dummy set of data is always a good thing.

Read More