Arpita Chopra Arpita Chopra - 4 years ago 106
PHP Question

fetch index of row of csv file using php

I want to fetch index of row of csv file in php but i'm not able to use

in php.

$value = $building."".$floor;
$val = $value.".".csv;
$file = fopen("csv/$val","r");
while(!feof($file)) {
$content = fgetcsv($file);
$index = indexOf($content);
$count1 = count($content);

Answer Source

As you are using a while loop you can initialize a variable counter = 0 outside the loop and inside the loop you can increment it e.g

    $content = fgetcsv($file);

Hope it helps

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download