PHP traversal parsing XML string method PHP soap XML parsing PHP parsing XML data php how to parse XM

Source: Internet
Author: User
Tags getting started with php
The example in this article describes how PHP iterates through parsing XML strings. Share to everyone for your reference, as follows:

<?php$content = <<
 
  
    
     
     
      HTTP
      
      
     
      /index.html
      
      
      
     
      2 
      
          
      
      
      
      
      
      
    
 
     3 
     
     
      
          
      
    
 
       
   
 

   
  XML; $test = new SimpleXMLElement ($content);//Get Ping_protocol value $ping_protocol = $test->global_setting->ping_ Protocol;echo "Ping_protocol: $ping _protocol \ n";//print out all instance Ipforeach ($test->instances->instance as $ Instance) {echo "IP: {$instance [' IP ']} \ n";} Here after testing, found that using var_dump and the like do not seem to be effective output value, with echo more smooth,//And there is the above example of XML can be removed <?xml version= "1.0" encoding= "UTF-8"?>// You can also go to the end of the <<
  
   <>< pre="">
 
   

For more information about PHP related content readers can view the topic: "PHP operation tips FOR XML file summary", "PHP date and Time usage summary", "PHP Object-oriented Programming tutorial", "PHP array" operation Skills Daquan, "PHP string ( String) Usage summary, "Getting Started with Php+mysql database operation" and "PHP common database Operation Skills Summary"

I hope this article is helpful to you in PHP programming.

The above describes the PHP traversal parsing XML string method, including parsing xml,php aspects of the content, I hope the PHP tutorial interested in a friend helpful.

  • <>

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.