The PHP Function Gztell
PHP has a lot of built-in functions that allow you to accomplish many common tasks. A function is a block of code that can be called by name to perform an action on multiple items, locations or variables in your script. This allows your code to be more modular and reusable.
For example, a function that writes output could be called by many different scripts to display information on a page, without any one of those functions needing to work out what it's going to write. This kind of separation is very important to good coding practice, and something that php-fig (the body that establishes standards for php coding) promotes.
The gztell function takes a file pointer and checks it for end-of-file (EOF). It is an equivalent of calling (in C) gzseek(zp, offset, SEEK_SET). It returns TRUE if the gz-file pointer is at EOF or an error occurs; otherwise it returns FALSE.
Alternatively, you can use the gzread or fwrite functions to read and write to a gzip compressed file. However, those functions tend to be slower and less memory efficient than this approach. This is especially true for large files. This method is also much more portable. You can use it on any platform that supports zlib, as long as you have a zlib extension installed.