Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. <?php
  2.  
  3. function print_r2($val)
  4. {
  5.     echo '<pre>';
  6.     print_r($val);
  7.     echo  '</pre>';
  8. }
  9.  
  10.  
  11. $desc = array();
  12. $xmlStr = file_get_contents("zitem.xml");
  13. $p = xml_parser_create();
  14. xml_parse_into_struct($p, $xmlStr, $vals, $index);
  15. xml_parser_free($p);
  16.  
  17. foreach($vals as $val)
  18. {
  19.     foreach ($val as $key => $value)
  20.     {
  21.         if ($key == 'attributes')
  22.         {
  23.             foreach ($value as $key2 => $val2)
  24.             {
  25.                 if (!in_array($key2, $desc) && $key2 != 'XMLNS')
  26.                 {
  27.                     array_push($desc, $key2);
  28.                 }
  29.             }
  30.         }
  31.     }
  32. }
  33.  
  34. echo "ZItem Attributes: <br/><br/>";
  35. print_r2($desc);
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement