PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of François NEUMANN-RYSTOW  >  Multi Dimensional Array  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: an example with simple data inside
Class: Multi Dimensional Array
Build a multi-dimensional array for a value list
Author: By
Last change:
Date: 6 years ago
Size: 446 bytes
 

Contents

Class file image Download
<?

//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());

?>