API16

JSimpleXMLElement/map: Difference between revisions

From Joomla! Documentation

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...
 
m preparing for archive only
 
(One intermediate revision by the same user not shown)
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.


<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JSimpleXMLElement/map|Edit Descripton]]<nowiki>]</nowiki>
</span>


{{Description:JSimpleXMLElement/map}}
 
 


===Syntax===
===Syntax===
Line 46: Line 44:
</source>
</source>


<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[SeeAlso:JSimpleXMLElement/map|Edit See Also]]<nowiki>]</nowiki>
 
</span>
{{SeeAlso:JSimpleXMLElement/map}}


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=map
  category=map
  category=JSimpleXMLElement
  category=JSimpleXMLElement
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*
  format= ,,,
  format= ,,,
</dpl>
</dpl>

Latest revision as of 02:06, 25 March 2017

Description

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



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);
                }
        }
}



Examples

Code Examples