Q . How to iterate Zf2 container class object ?

Brad Johnson. asked, Oct 12 ' 2015
$session = new Container();
I want to iterate all its elements like below.


  • zend-framework2
  • containers
  • iterate
  • session

1 Answers

You can iterate all the element by getIterator() method of container class.

$session = new Container();

echo '<pre>';
print_r((array) $session->getIterator());


Leave a Ansewer