Classes / Collections
Moderator: General Moderators
Classes / Collections
Coming from a VB/ASP background I am used to classes and collection objects. Can this be achieved with PHP?
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
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.
(#10850)
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Please check the manual.uruba_uk wrote:So an array in PHP is actually an object with its own functions? (similar to arrays in .NET?)
Array functions
Standard Library Objects
(#10850)