PHP | SplFileObject ftell() Function Last Updated : 20 Dec, 2018 Comments Improve Suggest changes Like Article Like Report The SplFileObject::ftell() function is an inbuilt function of Standard PHP Library (SPL) in PHP which is used to return the position of the file pointer which specifies the current offset in the file. Syntax: int SplFileObject::ftell( void ) Parameters: This function does not accept any parameters. Return values: This function returns the position of the file pointer. Below Programs illustrate the SplFileObject::ftell() function in PHP: Program 1: php <?php // Create an Spl Object $file = new SplFileObject("gfg.txt"); // Read line from file $data = $file->fgets(); // Print position echo $file->ftell(); ?> Output: 13 Program 2: php <?php // Create an Array $GFG = array( "dummy.txt", "gfg.txt", "frame.txt" ); // Loop to read each file foreach ($GFG as &$arr) { // Creating Spl Object $file = new SplFileObject($arr); // Function to read first line $data = $file->fgets(); // Display result echo $file->ftell() . "</br>"; } ?> Output: 13 15 13 Reference: http://php.net/manual/en/splfileobject.ftell.php Comment More infoAdvertise with us Next Article PHP | SplFileObject ftell() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-SplFileInfo Similar Reads PHP | SplFileObject fgets() Function The SplFileObject::fgets() function is an inbuilt function of the Standard PHP Library (SPL) in PHP which is used to get a line from the file. Syntax: string SplFileObject::fgets( void ) Parameters: This function does not accept any parameter. Return values: This function returns a string contain 1 min read PHP | SplFileObject fstat() Function The SplFileObject::fstat() function is an inbuilt function of Standard PHP Library (SPL) in PHP which is used to give the information of the file. Syntax: array SplFileObject::fstat( void ) Parameters: This function does not accept any parameter. Return values: This function returns an array which c 1 min read PHP | SplFileObject fread() Function The SplFileObject::fread() function is an inbuilt function of Standard PHP Library (SPL) in PHP which is used to reads the given number of bytes from the file. Syntax: string SplFileObject::fread( $length ) Parameters: This function accepts single parameter $length which is used to specify the lengt 1 min read PHP | SplFileObject fgetc() Function The SplFileObject::fgetc() function is an inbuilt function of Standard PHP Library (SPL) in PHP which is used to get character from file. Syntax: string SplFileObject::fgetc( void ) Parameters: This function does not accept any parameter. Return values: Returns single character read from the file or 1 min read PHP SplFileObject fseek() Function The SplFileObject::fseek() function is an inbuilt function of Standard PHP Library (SPL) in PHP that allows you to move the file pointer to a specified position within a file opened using SplFileObject. The file pointer is the position where the next read or write operation will occur. This function 2 min read Like