Syntax int xml_get_current_line_number int parser Description The xml_get_current_line_number function, which was added in PHP 3.0.6 and PHP 4.0, returns the line number that the parse
Trang 1Syntax
int xml_get_current_line_number (int parser)
Description
The xml_get_current_line_number() function, which was added in PHP 3.0.6 and PHP 4.0, returns the line number that the parser is currently processing
xml_get_current_column_number()
Syntax
int xml_get_current_column_number (int parser)
Description
The xml_get_current_column_number() function, which was added in PHP 3.0.6 and PHP 4.0, returns the column number on the current line that the parser is
currently processing
xml_get_current_byte_index()
Syntax
int xml_get_current_byte_index (int parser)
Description
The xml_get_current_byte_index() function, which was added in PHP 3.0.6 and PHP 4.0, returns the byte index that the parser is currently processing
xml_parser_free()
Syntax
string xml_parser_free (int parser)
Trang 2IT-SC book 341
Description
The xml_parser_free() function, which was added in PHP 3.0.6 and PHP 4.0, frees the parser and returns TRUE if successful; otherwise, it returns FALSE
xml_parser_set_option()
Syntax
int xml_parser_set_option (int parser, int option, mixed value)
Description
The xml_parser_set_option() function, which was added in PHP 3.0.6 and PHP 4.0, sets an option for the specified parser The possible option values are
XML_OPTION_CASE_FOLDING, which is an integer used to turn case-folding on and off (on by default), and XML_OPTION_TARGET_ENCODING, a string used set the target encoding type Encoding types include ISO-8859-1, US-ASCII, and UTF-8
xml_parser_get_option()
Syntax
mixed xml_parser_get_option (int parser, int option)
The xml_parser_get_option() function, which was added in PHP 3.0.6 and PHP 4.0, returns the value of the specified option See xml_parser_set_option() for the possible values
utf8_decode()
Syntax
string utf8_decode (string data)
Description
The utf8_decode() function, which was added in PHP 3.0.6 and PHP 4.0, decodes a character string with UTF-8 encoding to single-byte ISO-8859-1 encoding
utf8_encode()
Trang 3Syntax
string utf8_encode (string data)
Description
The utf8_encode() function, which was added in PHP 3.0.6 and PHP 4.0, encodes a character string with ISO-8859-1 encoding to UTF-8 encoding
Trang 4IT-SC book 343
Chapter 9 System Extensions
This chapter describes the PHP functions that interact with the operating system These functions return information about users, directories, files, and processes They provide information about the system and allow access to files and directories This chapter also contains specific information about how to interact with NIS and retrieve information from POSIX system calls There are also functions that enable you to manage shared memory, semaphores, and execute external scripts or programs and return the information to PHP
Directory
This section describes the functions that are used to open, read, change, rewind, and close directories Remember that permissions are important when using these functions If the user that is running the PHP script does not have permissions to perform the operation, the function will return an error
chdir()
Syntax
int chdir(string directory);
Description
The chdir() function changes the current working directory to directory This
function returns true, 1, if the function is successful; false, 0, is returned if there is a problem changing directories
dir()
Syntax
new dir(string directory);
Description
The dir() function uses object-oriented methodology for creating a directory object defined by directory This function returns two properties: handle and path The
handle property can be used with other directory functions, such as readdir() and
closedir() It behaves exactly as if the directory were opened using the opendir()
function The path property is set to the directory that was opened This should
Trang 5always be the same as the string directory that was used to call the function There
are three methods—read, rewind, and close—available with this function They operate the same as readdir(), rewinddir(), and closedir()
closedir()
Syntax
void closedir(int dir_handle);
Description
The closedir() function closes the directory defined by dir_handle The stream
must have previously been opened by opendir() or dir()
opendir()
Syntax
int opendir(string path);
Description
The opendir() function opens the directory defined by path and returns a directory
handle This directory handle is used when calling closedir(), readdir(), and
rewinddir()
readdir()
Syntax
string readdir(int dir_handle);
Description
The readdir() function returns the name of the next file from the directory defined
by dir_handle The filenames returned are not ordered or sorted in any particular
way
rewinddir()