<?php $filename = "c:\info.txt"; $fd = fopen ($filename, "r"); $contents = fread ($fd,filesize ($filename)); fclose ($fd); $newline = "\n"; $splitcontents = explode($newline, $contents); $counter = ""; ?> <font color="blue" face="arial" size="4">Complete File Contents</font> <hr> <?php echo $contents; ?> <br><br> <font color="blue" face="arial" size="4">Split File Contents</font> <hr> <table border="1"> <?php foreach ( $splitcontents as $color ) { $counter = $counter+1; #echo " $color\n<br>"; echo "<tr>"; $delimiter = "/t"; $splitcontents1 = explode($delimiter, $color); foreach ( $splitcontents1 as $value ) { if($value == null) { echo " "; } echo "<td> $value </td>"; } echo "</tr>"; } ?> </table>
Simple PHP Script to read Tab Delimited File
Monday, March 25, 2013
Subscribe to:
Post Comments (Atom)
5 comments:
Delimiter in line 32 should be tab not space
$delimiter = '\t';
Thanks for correction
This is really an amazing post, thanks for sharing such a valuable information with us, keep sharing!!
Docker Online Training
Kubernetes Online Training
Kubernetes Training in Hyderabad
Docker and Kubernetes Training in Hyderabad
Nice post. I learn something totally new and challenging on websites I come across on a daily basis. It will always be helpful to read through articles from other writers and use a little something from other websites.
UI Development Training in Bangalore
Reactjs Training in Bangalore
Nice post
https://www.santanu.biz
Post a Comment