Tuesday, 24 December 2019

Ch-13 ftell(),fseek() and rewind () function


ftell() function is use to know pointer location.

fseek() set pointer at  instructed location.
for example:
fseek($file,0)--> set pointer at begining.
fseek($file,5)--> set pointer at 5 location 

<?php
$file=fopen("user.txt","r");
echo ftell($file);

fseek($file,5);
echo ftell($file);
?>


rewind() function set pointer at 0 location

<?php
$file=fopen("user.txt","r");
echo ftell($file);
rewind($file);
echo ftell($file);

?>


No comments:

Post a Comment

Ch-16 Associate Array