All pastes #477556 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-05-08 18:28 UTC
rendered paste body
<?php
class JsonComponent extends Object {
	function dump($data = array()) {
		header('Expires: 0');
		header('Pragma: no-cache');
		echo "[\n";
		$item_glue="";
		foreach($data as $item) {
			echo $item_glue."{\n";
			$field_glue = "";
			foreach($item as $key => $value) {
				echo $field_glue."\"$key\" : \"$value\"";
				$field_glue = ",\n";
			}
			echo "\n}";
			$item_glue = ",\n";
		}
		echo "\n]";
		exit();
	}
}
?>