Page 1 of 1
Classes / Collections
Posted: Mon Sep 11, 2006 2:07 pm
by uruba_uk
Coming from a VB/ASP background I am used to classes and collection objects. Can this be achieved with PHP?
Posted: Mon Sep 11, 2006 2:20 pm
by Christopher
PHP certainly has classes. As for collections, the place to start is with PHP arrays which are hashes and have a large library of functions that operate on them. In PHP5 there is the SPL library that adds some classes in this category. And due to the power of PHP's hashes and supporting library you can easily create specific collection classes to do anything you need to do. If you are using PHP5, you might want to look at the __get()/__set() methods for accessors, and SPL for functionalty like array access and iteratable.
Posted: Mon Sep 11, 2006 2:28 pm
by uruba_uk
Thanks for the reply
So an array in PHP is actually an object with its own functions? (similar to arrays in .NET?)
Posted: Mon Sep 11, 2006 3:28 pm
by feyd
No, they are not objects.
Posted: Mon Sep 11, 2006 6:24 pm
by Christopher
uruba_uk wrote:So an array in PHP is actually an object with its own functions? (similar to arrays in .NET?)
Please check the manual.
Array functions
Standard Library Objects