Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online

simplexml element children function syntax tag tutorial 2013 Donate at flattr Flattr this





Alert! Connect with 10,000 Chating Online. Join Now

Php simplexml element children () function

Write your php code

 
<?php ?>

Php Result


Your code below



(no version information, might be only in CVS)

SimpleXMLElement->children --  Finds children of given node

Syntax

SimpleXMLElement simplexml_element->children ( void )

This method finds the children of the element of which it is a member. The result follows normal iteration rules.

Note: SimpleXML has made a rule of adding iterative properties to most methods. They cannot be viewed using var_dump() or anything else which can examine objects.

Example 1. Traversing a children() pseudo-array

<?php
$xml
= simplexml_load_string(
'<person>
<child role="son">
  <child role="daughter"/>
</child>
<child role="daughter">
  <child role="son">
   <child role="son"/>
  </child>
</child>
</person>'
);

foreach (
$xml->children() as $second_gen) {
    echo
' The person begot a ' . $second_gen['role'];

    foreach (
$second_gen->children() as $third_gen) {
        echo
' who begot a ' . $third_gen['role'] . ';';
    
        foreach (
$third_gen->children() as $fourth_gen) {
            echo
' and that ' . $third_gen['role'] .
                
' begot a ' . $fourth_gen['role'];
        }
    }
}
?>

This script will output:

The person begot a son who begot a daughter; The person
begot a daughter who begot a son; and that son begot a son

Php simplexml element children Function syntax tag

simplexml element children php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online



Php simplexml element children syntax tutorial

php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.


Function index

Variables

Expressions

Operators

Control-Structures

Cookies

Array

Date & Time

Directory function

File

Image

Operators

Form data handling

Mathematics operators

Mail

Php Mysql

Network Functions

Strings

php tutorial guides,functions, classes, code examples and tags for creating simple dynamic site to mysql database driven sites
 
 
Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online