PHP fseek() Function
Complete PHP Filesystem Reference Manual
Definition and Usage
The fseek() function seeks within an open file.
This function moves the file pointer forward or backward from its current position to a new position, measured in bytes from the beginning of the file.
Returns 0 on success, or -1 on failure. Note that seeking past the end of file (EOF) does not produce an error.
Syntax
fseek(file,offset,whence)
| Parameters | Description |
|---|---|
| file | Required. Specifies the file in which to seek. |
| offset | Required. Specifies the new position (measured in bytes from the beginning of the file). |
| whence | Optional. (Added in PHP 4). Possible values:
|
Tips and Notes
**Tip:** Use ftell() to find the current position!
Example
Complete PHP Filesystem Reference Manual