Jump to content

finding substring position


SchweppesAle

Recommended Posts

for what purppose?

 

http://www.phpfreaks.com/forums/index.php/topic,284320.msg1348337.html#msg1348337

 

I'm trying to use substr in combination with file_get_contents in order to parse an enormous csv file. 

 

I had tried the following code already with little success:

$file = 'nameOfFile.csv';
$handle = fopen($file, 'r'); 


$endOfRow = FALSE;
$offset = 0;
$maxLength = 2;

    $row = 1;
    while (($data = fgetcsv(fopen($file, "r"), 0, ",", '"'))) 	
    {
        $num = count($data);
        echo "<p> $num fields in line $row: <br /></p>\n";
        $row++;

        for ($c=0; $c < $num; $c++) 
{
            echo $data[$c] . "<br />\n";
        }
    
    }

 

 

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.