You are here

function traverse_xmlize in Quiz 6.5

Same name and namespace in other branches
  1. 6.6 includes/moodle/lib/xmlize.php \traverse_xmlize()

This helps you understand the structure of the array {@link xmlize()} outputs

Function by acebone@f2s.com, a HUGE help!<br> Usage:<br> <code> traverse_xmlize($xml, 'xml_'); print '<pre>' . implode("", $traverse_array . '</pre>'; </code> @author acebone@f2s.com

@todo Finish documenting this function

Parameters

array $array ?:

string $arrName ?:

int $level ?:

Return value

int

File

includes/moodle/lib/xmlize.php, line 178

Code

function traverse_xmlize($array, $arrName = 'array', $level = 0) {
  foreach ($array as $key => $val) {
    if (is_array($val)) {
      traverse_xmlize($val, $arrName . '[' . $key . ']', $level + 1);
    }
    else {
      $GLOBALS['traverse_array'][] = '$' . $arrName . '[' . $key . '] = "' . $val . "\"\n";
    }
  }
  return 1;
}