I currently have an array which I need to sort by email domain to post the data I have into a table. Here is the array I currently have (a shortened example) :
Array
(
[0] => wlrb@yahoo.com:7:8.35
[1] => hcda@able.com:4:5.59
[2] => kkyhid@hotmail.com:3:9.29
[3] => dxrjmowf@able.com:4:6.67
[4] => ybldb@hotmail.com:8:22.84
[5] => rcbyn@widgets.com:7:14.80
[6] => ggxxpkl@able.com:6:8.36
[7] => lnmpapq@hotmail.com:5:18.67
[8] => opkmc@widgets.com:5:22.88
[9] => wnkue@able.com:10:18.68
[10] => mgbbuqc@bodge.com:2:19.67
[11] => vswmdkqtb@bodge.com:5:21.89
and here is the code I am using currently to do this
<?php
$filename = "orderdata.txt";
// Open the file
$fp = @fopen($filename, 'r');
// Add each line to an array
if ($fp) {
$array = explode("
", fread($fp, filesize($filename)));
}
function pr($data)
{
print "<pre>";
print_r($data);
print "</pre>";
}
pr($array);
?>
I would like to post the data into a table in this format(cant use a database):
+-----------------------------------------------+
| able.com |
+---------------+------------------+------------+
| andy@able.com | 1 | 20.30 |
| ed@able.com | 4 | 5.05 |
+---------------+------------------+------------+
| bodge.com |
+---------------+------------------+------------+
| foo@bodge.com | 3 | 132.20 |
+---------------+------------------+------------+
The second column is order amount and the last column is price.
Could anyone help me in my quest?