PHP ftell() Function

PHP ftruncate() Function
PHP fstat() Function

In this article, you will learn how to get the current position of the file pointer in PHP. The ftell() function in PHP returns the current position of the read/write pointer in an open file.

what is the syntax of the FTELL function in php?

ftell(file)
ParameterDescription
fileRequired. Specifies the open file to check
PHP ftell() method

examples of the FTELL function

Example 1. In this example, we return the current position of the read/write pointer in an open file.

<?php
$file = fopen("test.txt","r");

// Print current position
echo ftell($file);

// Change current position
fseek($file,"15");

// Print current position again
echo "<br>" . ftell($file);

fclose($file);
?>
PHP ftruncate() Function
PHP fstat() Function
en English
X
Scroll to Top