Revision: 5562
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 16, 2008 04:45 by iTony
Initial Code
<?php $handle = @fopen("data.txt", "r"); if ($handle) { while (!feof($handle)) { $buffer = fgets($handle, 4096); // this will search for 5 spaces and replace with 1, then 4, then 3, then 2 // then only one will be left. Replace that one space with a comma // then output with nl2br so you can see the line breaks print nl2br(str_replace(" ", ",",ereg_replace( ' ', ' ',ereg_replace( ' ', ' ', ereg_replace( ' ', ' ', ereg_replace( ' ',' ',$buffer )))))); } } fclose($handle); ?>
Initial URL
Initial Description
Initial Title
file spaces to commas
Initial Tags
csv
Initial Language
PHP