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