API16

API16:JSimpleXMLElement/map

From Joomla! Documentation

Revision as of 22:56, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== traverses the tree calling the $callback(JSimpleXMLElement $this, mixed $args=array()) function with each JSimpleXMLElement. <span class="editsection" style="font-size...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

traverses the tree calling the $callback(JSimpleXMLElement $this, mixed $args=array()) function with each JSimpleXMLElement.

[Edit Descripton]

Template:Description:JSimpleXMLElement/map

Syntax

map($callback, $args=array())
Parameter Name Default Value Description
$callback $callback function name
$args array() $args

Defined in

libraries/joomla/utilities/simplexml.php

Importing

jimport( 'joomla.utilities.simplexml' );

Source Body

function map($callback, $args=array())
{
        $callback($this, $args);
        // Map to all children
        if ($n = count($this->_children)) {
                for ($i=0;$i<$n;$i++)
                {
                        $this->_children[$i]->map($callback, $args);
                }
        }
}

[Edit See Also] Template:SeeAlso:JSimpleXMLElement/map

Examples

<CodeExamplesForm />