- var_dump: documentation ( source)
- reset: documentation ( source)
- next: documentation ( source)
- current: documentation ( source)
<?php
$items = array('A'=>'Apple', 'B'=>'Bee', 'C'=>'Candy');
var_dump(next($items)); // string(3) "Bee" because next() returns next element and advances pointer to next element
foreach($items as $element) {
echo $element,PHP_EOL; // print all of $items elements
reset($items); // Reset mid-loop!
}
var_dump(current($items)); // Should be 'string(3) "Bee"' because next() is called before foreach, but returns FALSE
reset($items);
var_dump(current($items)); // string(5) "Apple". reset() called. It should be "Apple".