What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Generating and displaying a PHP array as a table?

Generating and displaying a PHP array as a table?
Author: Message:
NanaFreak
Scripting Contest Winner
*****


Posts: 1476
Reputation: 53
32 / Male / Flag
Joined: Jul 2006
RE: Generating and displaying a PHP array as a table?
ok this is what i came up with, it may not be the most efficient but it still works (with the example that you gave me...)

php code:
<?php

$file = './path/to/file.ext';

preg_match_all('/"([^"]*)"\n\s*\{\n\s*"auth"\s*"([^"]*)"\n\s*"identity"\s*"([^"]*)"\n\s*"group"\s*"([^"]*)"\n\s*"immunity"\s*"([^"]*)"/',file_get_contents($file),$matches);

echo '<table border="1px solid #000">';
for($i=0;$i<count($matches[0]);$i++){
    echo '<tr>';
    echo '<td>'.$matches[1][$i].'</td>';
    echo '<td>'.$matches[2][$i].'</td>';
    echo '<td>'.$matches[3][$i].'</td>';
    echo '<td>'.$matches[4][$i].'</td>';
    echo '<td>'.$matches[5][$i].'</td>';
    echo '</tr>';
}
echo '</table>';

?>

note: also i assumed that you are running on a linux box seeing as it is a css config... if you need a fix for windows just ask... [=

This post was edited on 08-24-2009 at 10:43 AM by NanaFreak.
08-24-2009 10:42 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Generating and displaying a PHP array as a table? - by Jimbo on 08-23-2009 at 10:54 PM
RE: Generating and displaying a PHP array as a table? - by NanaFreak on 08-24-2009 at 07:35 AM
RE: Generating and displaying a PHP array as a table? - by Jimbo on 08-24-2009 at 09:57 AM
RE: Generating and displaying a PHP array as a table? - by NanaFreak on 08-24-2009 at 10:42 AM
RE: Generating and displaying a PHP array as a table? - by Jimbo on 08-24-2009 at 10:49 AM
RE: Generating and displaying a PHP array as a table? - by NanaFreak on 08-24-2009 at 10:52 AM
RE: Generating and displaying a PHP array as a table? - by Jimbo on 08-24-2009 at 11:01 AM
RE: Generating and displaying a PHP array as a table? - by Felu on 08-24-2009 at 01:20 PM
RE: Generating and displaying a PHP array as a table? - by Jimbo on 08-24-2009 at 01:48 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On