I have an Associative Array with 1 Key and 2 Values Like this:
<?php
// file path
$file = 'input.txt'; // REMEMBER TO MENTION THE CORRECT FILE WITH EXTENSION
// open the file and get the resource handle with errors suppressed
$handle = @fopen($file,'r'); // DONT USE @ while at development since it will suppress errors
// array to hold our values
$params = array();
if($handle)
{
// if handle is there then file was read successfully
// as long as we aren't at the end of the file
while(!feof($handle))
{
$line = fgets($handle);
$temp = explode(':',$line);
$params[$temp[0]][] = $temp[1];
$params[$temp[0]][] = $temp[2];
}
fclose($handle);
}
?>
The Input.txt contains:
key:Value1:Value2
[email protected]:1:11
[email protected]:2:12
[email protected]:3:13
[email protected]:4:14
I need to go through the array and display the results in a HTML table like this:
+-----------------------------------------------------+
| example.com |
+---------------------+------------------+------------+
| [email protected] | 1 | 11 |
| [email protected] | 4 | 14 |
+---------------------+------------------+------------+
| test.com |
+---------------------+------------------+------------+
| [email protected] | 3 | 13 |
| [email protected] | 2 | 12 |
+---------------------+------------------+------------+
How can This Be Done?