JSimpleXMLElement/map: Difference between revisions
From Joomla! Documentation
m removing red link to edit, no existant pages |
m preparing for archive only |
||
| Line 52: | Line 52: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=map | category=map | ||
category=JSimpleXMLElement | category=JSimpleXMLElement | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
Latest revision as of 01:09, 25 March 2017
Description
traverses the tree calling the $callback( JSimpleXMLElement $this, mixed $args=array() ) function with each JSimpleXMLElement.
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
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);
}
}
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
Code Examples