Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. <?php
  2.  
  3. class Iterator implements Iterator {
  4. protected $data;
  5.  
  6. public function __construct($data) {
  7. $this->data = $data;
  8. }
  9.  
  10. function rewind() {
  11. return reset($this->data);
  12. }
  13.  
  14. function current() {
  15. return current($this->data);
  16. }
  17.  
  18. function key() {
  19. return key($this->data);
  20. }
  21.  
  22. function next() {
  23. return next($this->data);
  24. }
  25.  
  26. function valid() {
  27. return !is_null(key($this->myArray));
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement