Jump to content

help with phashing file out puts


loki951510

Recommended Posts

hi all dont know if you can help

 

im trying to remember how to do this i have a program what out puts the data like this

 

The Fortress of the Aesir|xxxxxxx|Licat volare si super tergum Aquila volat.|14|0|United Kingdom|

 

but i cant for the life of me remember how to make the php but each bit into a didnt box on a web page

 

can someone plz help me

Link to comment
https://forums.phpfreaks.com/topic/180608-help-with-phashing-file-out-puts/
Share on other sites

there are many was to do this

 

<?php
$str = "The Fortress of the Aesir|xxxxxxx|Licat volare si super tergum Aquila volat.|14|0|United Kingdom|";
$str = preg_replace('#|$#', '', $str);
print "<table border='1'>";
print "<tr><td>Name</td><td>Address</td><td>Description</td><td>Users</td><td>Share</td><td>Location</td></tr>";
call_user_func_array('printf', array_merge(array("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>"), explode("|", $str)));
print "</table>";
?>

 

or a simpler way to understated

 

<?php
$str = "The Fortress of the Aesir|xxxxxxx|Licat volare si super tergum Aquila volat.|14|0|United Kingdom|";
$str = preg_replace('#|$#', '', $str);

list ($name, $address, $desc, $users, $share, $location) = explode('|', $str);
echo "<table border='1'>";
echo "<tr><td>Name</td><td>Address</td><td>Description</td><td>Users</td><td>Share</td><td>Location</td></tr>";
echo "<tr><td>$name</td><td>$address</td><td>$desc</td><td>$users</td><td>$share</td><td>$location</td></tr>";
echo "</table>";
?>

 

and many other ways too

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.