Page 1 of 1
Code required for interfaces, Iterator & Countable in ph
Posted: Wed Aug 29, 2007 9:54 am
by raghavan20
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.
Posted: Wed Aug 29, 2007 11:50 am
by Begby
You can create those interfaces but it won't help. Countable will let you do this
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.
Posted: Wed Aug 29, 2007 1:16 pm
by raghavan20
i did create Countable and Iterator interfaces from the api provided. It did work. These interfaces are required by Zend_Config. anyway, thanks for your help.