gzgetc Syntax string gzgetcint gz_pointer Description The gzgetc function returns a single, uncompressed character from the file pointed to by gz_pointer.. gzgets Syntax string gzg
Trang 1The gzfile() function, which operates like readgzfile() except that it returns an array, returns the contents of a gz_file If the optional include_path is set to 1, PHP will look for the gz_file in the include_path, as specified by the php.ini file
gzgetc()
Syntax
string gzgetc(int gz_pointer)
Description
The gzgetc() function returns a single, uncompressed character from the file pointed to by gz_pointer If the file is at the end (EOF), FALSE is returned
gzgets()
Syntax
string gzgets(int gz_pointer, int length)
Description
The gzgets() function returns a single, uncompressed line from the file pointed to
by gz_pointer It stops when it hits a newline character or the end of file (EOF)
marker If the EOF is hit, FALSE is returned
gzgetss()
Syntax
string gzgetss(int gz_pointer, int length [, string allowable_tags])
Description
The gzgetss() function returns uncompressed length number of characters from gz_pointer , and removes any HTML or PHP tags After PHP 3.0.13, an optional allowable_tags parameter has been added to specify HTML or PHP tags that you
want to leave in If the EOF is hit, FALSE is returned
gzopen()
Trang 2Syntax
int gzopen(string gz_file, string mode [, int include_path])
Description
The gzopen() function attempts to open gz_file and return a file pointer for later
operations If you have include_path set to 1, PHP will look for the gz_file in the
include_path specified in the php.ini file The mode parameter tells the function how
to open the file This can be any of the items listed in Table 11.11
Table 11.11 Various Modes in Which a gz File Can Be Opened
1–9 Compression level
f Filtered data (strategy)
h Huffman only compression
gzpassthru()
Syntax
int gzpassthru (int gz_pointer)
Description
The gzpassthru() function returns all remaining data located at the gz_pointer that has not been retrieved This stops only at the end of file (EOF) marker
gzputs()
Syntax
int gzputs(int gz_pointer, string string [, int length])
Description
The gzputs() function is an alias to the gzwrite() function, where it writes string until length to the file located at gz_pointer
Trang 3If the optional length argument is passed, the magic_quotes_runtime
configuration option in the php.ini file is ignored
gzread()
Syntax
string gzread(int gz_pointer, int length)
Description
The gzread() function reads and returns until length is reached in the uncompressed gz_pointer file
gzrewind()
Syntax
int gzrewind (int gz_pointer)
Description
The gzrewind() function resets gz_pointer to the beginning of the gz file If an error occurs, 0 is returned
gzseek()
Syntax
int gzseek(int gz_pointer, int offset)
Description
The gzseek() function sets the current pointer inside the gz file to offset bytes from its current location Do note that if the file is opened for reading only, this operation can be very slow Additionally, if the file is opened for writing, you can seek only in a forward direction
Trang 4gztell()
Syntax
int gztell(int gz_pointer)
Description
The gztell() function returns the current position of the internal pointer to the
gz_pointer file
gzuncompress()
Syntax
string gzuncompress(string data [, int level])
Description
The gzuncompress() function, which was added in PHP 4.0.1, takes the data compressed by the gzcompress() function and returns up to length of that data in
an uncompressed format
gzwrite()
Syntax
int gzwrite(int gz_pointer, string string [, int length])
Description
The gzwrite() function is the same as the gzputs() function; it writes string up to
length to the file located at gz_pointer
Note
If the optional length argument is passed, the magic_quotes_runtime
configuration option in the php.ini file will be ignored
Trang 5readgzfile()
Syntax
int readgzfile(string gz_file [, int include_path])
Description
The readgzfile() function reads gz_file , decompresses it, and sends it to standard output (STDOUT) If you specify include_path to equal to 1, PHP looks for
gz_file in the include_path directory, which is set in the php.ini file
Date and Time
The date and time functions within PHP enable you to obtain and format time and date stamps for your scripts There are also functions that enable you to validate specific styles of time formats
checkdate()
Syntax
int checkdate(int month, int date, int year)
Description
The checkdate() function validates the Gregorian date/time passed, which is represented by the month, date , and year parameters If the date is valid, 1 is
returned Do note that the following rules apply to these parameters:
• month —Must be between 1 and 12
• date —Must be within the allowed number of days for the given month Leap
years are taken into consideration
• year —Must be between 1 and 32767
date()
Syntax
string date(string format [, int time_stamp])