All pastes #199577 Raw Edit

Miscellany

public php v1 · immutable
#199577 ·published 2006-10-12 16:40 UTC
rendered paste body
<?phpfunction ArrayBreakdown ($myArray,$prefix,$echo = true) {	$iIndex=-1;	if (!$echo) {		ob_start();	}	if (!is_array($myArray)) {		echo $prefix." = $myArray<br>";	}	else {		foreach ($myArray as $key => $value) {			if (!is_numeric($key)) {				$key = "'$key'";			}			if (is_array($value)) {				echo $prefix."[".$key."] = Array {<br>";				echo ArrayBreakdown($value,"&nbsp;&nbsp;".$prefix."[".$key."]",false);				echo "}<br>";			}			else {				echo $prefix."[".$key."] = '".htmlentities($value)."'<br>";			}		}	}	if (!$echo) {		$ArrayOutput = ob_get_contents();		ob_end_clean();		return $ArrayOutput;	}}//either $x = ArrayBreakdown($array,"prefix",false);  //returns the html//or ArrayBreakdown($array,"prefix");  //outputs html her