034.phpt 337 B

12345678910111213141516171819202122
  1. --TEST--
  2. SimpleXML: cast to array
  3. --EXTENSIONS--
  4. simplexml
  5. --FILE--
  6. <?php
  7. $string = '<?xml version="1.0"?>
  8. <foo><bar>
  9. <p>Blah 1</p>
  10. <p>Blah 2</p>
  11. <p>Blah 3</p>
  12. <tt>Blah 4</tt>
  13. </bar></foo>
  14. ';
  15. $foo = simplexml_load_string($string);
  16. $p = $foo->bar->p;
  17. echo count($p);
  18. $p = (array)$foo->bar->p;
  19. echo count($p);
  20. ?>
  21. --EXPECT--
  22. 33