<?php 
	$data = array( array("firstname" => "Mary", "lastname" => "Johnson", "age" => 25), array("firstname" => "Amanda", "lastname" => "Miller", "age" => 18), array("firstname" => "James", "lastname" => "Brown", "age" => 31), array("firstname" => "Patricia", "lastname" => "Williams", "age" => 7), array("firstname" => "Michael", "lastname" => "Davis", "age" => 43), array("firstname" => "Sarah", "lastname" => "Miller", "age" => 24), array("firstname" => "Patrick", "lastname" => "Miller", "age" => 27) );
	 header("Content-Type: text/plain"); 
	 $flag = false; foreach($data as $row) {
	 	if(!$flag) { 
	 		# display field/column names as first row 
	 		echo implode("\t", array_keys($row)) . "\n"; 
	 		$flag = true; 
	 	} 
	 	echo implode("\t", array_values($row)) . "\n"; 
	 
	 }
?>