PageRenderTime 45ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/bad/ext/spl/tests/array_007.php

http://github.com/facebook/hiphop-php
PHP | 39 lines | 27 code | 9 blank | 3 comment | 0 complexity | 164d060c899ab194efc8463f19d1b38b MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
  1. <?php
  2. // This test also needs to exclude the protected and private variables
  3. // since they cannot be accessed from the external object which iterates
  4. // them.
  5. class test implements IteratorAggregate
  6. {
  7. public $pub = "public";
  8. protected $pro = "protected";
  9. private $pri = "private";
  10. function __construct()
  11. {
  12. $this->imp = "implicit";
  13. }
  14. function getIterator()
  15. {
  16. $it = new ArrayObject($this);
  17. return $it->getIterator();
  18. }
  19. };
  20. $test = new test;
  21. $test->dyn = "dynamic";
  22. print_r($test);
  23. print_r($test->getIterator());
  24. foreach($test as $key => $val)
  25. {
  26. echo "$key => $val\n";
  27. }
  28. ?>
  29. ===DONE===
  30. <?php exit(0); ?>