PHP ftell() Function

Definition

The ftell() function returns the current position in an open file.

Syntax

PHP ftell() Function has the following syntax.

ftell(file)

Parameter

ParameterIs RequiredDescription
fileRequired.Open file to check

Return

Returns the current file pointer position, or FALSE on failure.

Example

Returns the current position in an open file


<?php/*from  www.  ja  v  a2s  .co  m*/
$file = fopen("test.txt","r");

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

// change current position
fseek($file,"25");

// print current position again
echo "\n";
echo ftell($file);

fclose($file);
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions