Horje
How to get first 100 records from a csv file in PHP | PHP Extract Code
How to get first 100 records from a csv file in PHP

Here is simple way to get first 100 records from csv file.


How to extract first 100 records from a TXT file in PHP

Follow the Example
index.php
Example: PHP
<?php
$start = 1; 
$end = 100;
$handle = fopen("file.csv", "r");
$i = 0;
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
if(($start <= $i) && ($i <= $end)) {

    
    echo $data[0];
    echo '</br>';
    
}
elseif($i > $end) {
    break;
}
$i++;
}

fclose($handle);
?>

Output should be:

How to extract first 100 records from a TXT file in PHP



Read Full::
PHP Extract Code
Category:
PHP Tutorial Code
Sub Category:
PHP Extract Code
Uploaded:
1 week ago
Uploaded by:
Admin
Views:
9
Tested on:
PHP 7

Related Articles
How to get first Five Line from CSV File PHP Extract Code
How to get first 100 records from a csv file in PHP PHP Extract Code

Single Articles
How to extract first 100 records from a TXT file in PHP

Share on: