Build Autoload PHP Classes


This post will explain PHP autoload and name space concept using a few basic question and answer about PHP autoload along with some examples.

What is Autoloading in PHP?

PHP provides helper functions to include or import PHP files, if it has not been included before. if we use PHP autoload then we don't need to write require or include statement for each PHP class files. We should ...

  • 02 Nov 2014
  • Zainul Abedin
  • PHP-5
  • 991 Read
  • 31 Comments
READ MORE

PHPs Database Operation Go OOP


This tip is a guide to writing database operation code in PHP - the Object Oriented way. I have come across people asking me the proper way of writing database operation code in PHP on a number of occasions. Not wanting to answer the same question over and over again, I have decided to publish the answer here.


The Approach

Step 1: Create a PHP page called "config.php" that ...

  • 08 Oct 2014
  • Peter Leow
  • PHP-5
  • 1228 Read
  • 23 Comments
READ MORE

PHP Cache Dynamic Pages To Speed Up Load Times


If your website has hundreds of pages with many visitors everyday, you might want to implement some sort of caching mechanism for your website to speed up page loading time. Each client-server request consist of multiple database queries, server response and the processing time increasing overall page loading time. The most common solution is to make copies of dynamic pages called cache files and store them in a separate directory, ...

  • 15 Sep 2014
  • Saran Chamling
  • PHP-5
  • 1258 Read
  • 26 Comments
READ MORE

Working With Date And Time In Object Oriented Way


Date and time manipulation in PHP is mostly connected with functions like: date, time or strtotime. They can be sufficient, but if we want to deal with dates like with objects we can use DateTime class. DateTime class is not only straightforward wrapper for standard functions, it has a lot of additional features for example timezones.

Date creation

public DateTime::__construct() ([ string $time = "now" [, DateTimeZone $timezone ...
  • 05 Sep 2014
  • Slawek Lukasiewicz
  • PHP-5
  • 766 Read
  • 31 Comments
READ MORE

Standard PHP Library Iterators


I have posted some information about Standard PHP Library recently. Because SPL is one of my favourite PHP extension I decided to write about another neat feature from this toolbox about iterators.

According to wikipedia:
In computer programming, an iterator is an object that enables a programmer to traverse a container. In SPL we can find a lot of implemented Iterators. Most of them are decorators, so they work ...

  • 19 Dec 2013
  • Slawek Lukasiewicz
  • PHP-5
  • 440 Read
  • 21 Comments
READ MORE

PHP Best Practises


There are a number of good practises that you should follow when developing web applications in PHP. Most of these are extremely easy to pick up and some of them will even apply to web application development in general.

1. Redirect after a successful POST request.

This is not PHP-specific. To avoid a situation where the user refreshes their browser and submits the same form data twice, you ...

  • 18 Dec 2013
  • TIM
  • PHP-5
  • 1184 Read
  • 23 Comments
READ MORE

Whats New in PHP 5.4


Introduction

PHP is growing up fast. There has been a major push from the folks at Zend (the company that maintains PHP), and this focuses on two major concerns; security, and the object oriented aspects of the language. We've come a long way from PHP 4, which introduced a very simple and shaky object oriented interface for developers to play with. But PHP 5 changed that, and with every increment ...

  • 18 Dec 2013
  • Marc Plotz
  • PHP-5
  • 639 Read
  • 72 Comments
READ MORE