Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPComplete:
New Tutorial on Structures in PHP
Nov 25, 2002 @ 14:30:18

Over on PHPComplete this morning, there's a new tutorial posted about how to create structures in PHP (not control structures, like ifs and whiles, though). No, these structures are more like the C structures: A long time ago, it occurred to me that the only (and obvious) difference between structures and objects is where the functions are and what they are called. Of course, within an object, a function is often termed "method". Not to mention that it's inside the object. On the other hand, the existence of a structure doesn't really imply the existence of a function or functions.

The tutorial goes on to talk about the differences between what would be considered a "structure" in PHP (since it doesn't really have the ability to create those). He goes through quite a bit of benchmarking to show which way is faster, arrays versus just a class with the information stored in it - and you might be surprised by some of the results that he finds.

tagged:

Link:


Trending Topics: