Copying PHP Objects

When working with PHP object-oriented programming, the concept of creating copies of objects you’ve created can be a little confusing. The main thing you need to understand is that PHP objects are passed byref rather than the standard variable behavior of passing elements byval.

In case you have never heard those terms before, byref means “by reference,” which means that you are essentially assigning an additional name to your original variable. ByVal means “by value,” which means that you are actually copying the variable, creating an entirely new instance of it.

CGForms First Beta Released

Over the last few years, I have been slowly working on developing a series of PHP classes to handle Web forms. I have finally got enough of the code together and in a portable format to feel comfortable releasing it to the public. The project is called CGForms, is hosted on SourceForge and is completely open and free.

CGForms is intended to make things easier and provide a process for PHP developers to churn out Web forms without having to worry about writing complex processing and validating scripts over and over again. CGForms offers a centralized codebase from which all of your forms are generated, validated and processed (by sending results through e-mail – using HTMLMimeMail5 – and/or saving them to a database).

Object-Oriented Programming – Parents and Children

This post is going to be a somewhat short abstract about the concept of parents and children in object-oriented programming (OOP). The first thing of which people new to OOP need to be aware is that parents and children are are not handled as logical parents and children, they are handled more like biological parents and children. It is best to think of the parent/child relationship in OOP as a concept of “inheritance” rather than a concept of containers and contained elements.