jrm Posted August 22, 2008 Share Posted August 22, 2008 I am trying to figure out whether having a multi-dimensional array ( 4 levels ) is "better" than to have a complex while{mysql_fetch_array} : a. Speed b. Size c. coding the output d. which way to code the array /* $Year = PRTYear(); $Month = for loop running the 1 - 12 $TypeID = PRTType(); */ // Array 1 $PRT[$Year][$Month][$TypeID] = PRTTypeCountperMonth($Year,$Month,$Type); // Array 2 $PRT[] = array("Year" => $Year, "Month" => $Month, "Type" => $Type, "Count" => PRTTypeCountperMonth($Year, $Month, $Type)); // Array 3 $PRT[] = array($Year => array ($Month => array($Type => PRTTypeCountperMonth($Year, $Month, $Type))); or while($Year) // shortened mysql statements { echo "\n" . $Year; while($Month) { echo "\n" . $Month; while($Type) { echo "\n" . $Type . " Count : " . $Count; } } } Link to comment https://forums.phpfreaks.com/topic/120866-multi-dimension-array-vs-complex-whilemysql-loop/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.