In this segment of the PHP tutorial we will learn the use of PHP fscanf() file handling function and its example.
In this segment of the PHP tutorial we will learn the use of PHP fscanf() file handling function and its example.
Syntax
mixed fscanf file_handle,format_specifier [, mixed &$... ] )
<?php
$file=fopen("c:/rose1/ram.txt","r");
while($ar1=fscanf($file,"%s\t%s"))
{
for($x=0;$x<sizeof($ar1);$x++)
{
echo $ar1[$x];
if ($x%2!=0)
echo "<br>";
}
}
?>
Output
first_namelast_name
ramkumar
shyamsinha