SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 162 | Next

Hasin Hayder

"Object-Oriented Programming with PHP5"

"\n";
}
?>
And the output is:
Lily Bernard
Ayesha Siddika
NoRewindIterator
This is another Iterator in which you can't invoke the rewind method. That means it
is a forward-only Iterator, which can read a collection only once. Take a look at the
structure; if you execute the following code you will get the methods supported by
this Iterator:
print_r(get_class_methods(NoRewindIterator));
//you can also use refelection API as before to see the methods.
?>
Chapter 6
[ 159 ]
The output would be the methods, as seen below:
Array
(
[0] => __construct
[1] => rewind
[2] => valid
[3] => key
[4] => current
[5] => next
[6] => getInnerIterator
)
Surprisingly, it has no rewind method, but you can see it, can't you? Well, that
method has no implementation, it is empty. It is there as it implements the Iterator
interface, but there is no implementation of that function, so you can't rewind.
$arr = array(
array("name"=>"John Abraham", "sex"=>"M", "age"=>27),
array("name"=>"Lily Bernard", "sex"=>"F", "age"=>37),
array("name"=>"Ayesha Siddika", "sex"=>"F", "age"=>26),
array("name"=>"Afif", "sex"=>"M", "age"=>2)
);
$persons = new ArrayObject($arr);
$LI = new NoRewindIterator($persons->getIterator());
foreach ($LI as $person) {
echo $person['name'].


Pages:
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6