Code required for interfaces, Iterator & Countable in ph
Moderator: General Moderators
- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
Code required for interfaces, Iterator & Countable in ph
we have a live server running with PHP version 5.0.4 but we have a latest version running in our test server. I managed to use a Zend module from Zend framework in test server but it throws error as it could not find Countable.php and Iterator.php. I am wondering whether I would be able to get actual php code for these two files.
You can create those interfaces but it won't help. Countable will let you do this
That will fail under php 5.04 even if you do recreate the countable interface. Same thing will happen with the Iterator interface. As soon as you try to use your object in a foreach loop it will fail. Your only solution is to not use SPL or to upgrade the live server.
Code: Select all
class myClass implements Countable
{
public function count() { ... }
}
$instance = new myClass() ;
count($instance) ;That will fail under php 5.04 even if you do recreate the countable interface. Same thing will happen with the Iterator interface. As soon as you try to use your object in a foreach loop it will fail. Your only solution is to not use SPL or to upgrade the live server.
- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact: