JSimpleXMLElement/map: Difference between revisions
From Joomla! Documentation
New page: ===Description===
traverses the tree calling the $callback(JSimpleXMLElement $this, mixed $args=array()) function with each JSimpleXMLElement.
<span class="editsection" style="font-size... |
m clean up |
||
| Line 2: | Line 2: | ||
traverses the tree calling the $callback(JSimpleXMLElement $this, mixed $args=array()) function with each JSimpleXMLElement. | traverses the tree calling the $callback(JSimpleXMLElement $this, mixed $args=array()) function with each JSimpleXMLElement. | ||
{{Description:JSimpleXMLElement/map}} | |||
{{subst:Description:JSimpleXMLElement/map}} | |||
===Syntax=== | ===Syntax=== | ||
| Line 46: | Line 44: | ||
</source> | </source> | ||
{{subst:SeeAlso:JSimpleXMLElement/map}} | |||
{{SeeAlso:JSimpleXMLElement/map}} | |||
===Examples=== | ===Examples=== | ||
Revision as of 14:26, 24 March 2017
Description
traverses the tree calling the $callback(JSimpleXMLElement $this, mixed $args=array()) function with each JSimpleXMLElement.
{{subst: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);
}
}
}
{{subst:SeeAlso:JSimpleXMLElement/map}}
Examples
<CodeExamplesForm />