Location: PHPKode > scripts > Multi Dimensional Array > multi-dimensional-array/example.php
<?

//action;location;fruits;number
$data = 
"buy;paris;orange;1
buy;paris;banana;2
sell;paris;orange;3
sell;paris;banana;4
buy;london;orange;5
buy;london;banana;6
sell;london;orange;7
sell;london;banana;8";

require 'mda.php';

$mda = new mda(3, 'TOTAL');

$lines = explode("\n", $data);
foreach ($lines as $line) {
    $cells = explode(';', $line);
    $mda->add(Array($cells[0], $cells[1], $cells[2]), $cells[3]);
}

print_r($mda->res());

?>
Return current item: Multi Dimensional Array