diff --git a/functions/filesystem.xml b/functions/filesystem.xml index cd53decab9..3d470d486f 100644 --- a/functions/filesystem.xml +++ b/functions/filesystem.xml @@ -5,7 +5,9 @@ basename - return filename component of path + + Return filename component of path + Description @@ -41,7 +43,7 @@ $file = basename($path); // $file is set to "index.php3" chgrp - change file group + Change file group Description @@ -72,7 +74,7 @@ $file = basename($path); // $file is set to "index.php3" chmod - change file mode + Change file mode Description @@ -140,7 +142,7 @@ chmod( "/somedir/somefile", 0755 ); // octal; correct value of mode clearstatcache - clear file stat cache + Clear file stat cache Description @@ -187,7 +189,7 @@ chmod( "/somedir/somefile", 0755 ); // octal; correct value of mode copy - copy file + Copy file Description @@ -217,7 +219,7 @@ if (!copy($file, $file.'.bak')) { delete - a dummy manual entry + A dummy manual entry Description @@ -239,7 +241,7 @@ if (!copy($file, $file.'.bak')) { dirname - return directory name component of path + Return directory name component of path Description @@ -273,7 +275,7 @@ $file = dirname($path); // $file is set to "/etc" diskfreespace - return available space in directory + Return available space in directory Description @@ -300,7 +302,7 @@ $df = diskfreespace("/"); // $df contains the number of bytes fclose - close an open file pointer + Close an open file pointer Description @@ -325,7 +327,7 @@ $df = diskfreespace("/"); // $df contains the number of bytes feof - test for end-of-file on a file pointer + Test for end-of-file on a file pointer Description @@ -440,7 +442,7 @@ fclose ($fp); fgets - get line from file pointer + Get line from file pointer Description @@ -496,7 +498,9 @@ fclose ($fd); fgetss - get line from file pointer and strip HTML tags + + Get line from file pointer and strip HTML tags + Description @@ -518,7 +522,6 @@ fclose ($fd); You can use the optional third parameter to specify tags which should not be stripped. - allowable_tags was added in PHP 3.0.13, @@ -569,7 +572,7 @@ fclose ($fd); file_exists - Check whether a file exists. + Check whether a file exists Description @@ -635,7 +638,7 @@ fclose ($fd); filegroup - get file group + Get file group Description @@ -672,7 +675,6 @@ fclose ($fd); The results of this function are cached. See clearstatcache for more details. - @@ -724,7 +726,7 @@ fclose ($fd); fileperms - get file permissions + Get file permissions Description @@ -745,7 +747,7 @@ fclose ($fd); filesize - get file size + Get file size Description @@ -766,7 +768,7 @@ fclose ($fd); filetype - get file type + Get file type Description @@ -789,7 +791,7 @@ fclose ($fd); flock - portable advisory file locking + Portable advisory file locking Description @@ -804,9 +806,10 @@ fclose ($fd); same way of locking or it will not work). - flock operates on fp which - must be an open file pointer. operation is one of - the following values: + flock operates on fp + which must be an open file + pointer. operation is one of the following + values: @@ -851,7 +854,7 @@ fclose ($fd); fopen - open file or URL + Open file or URL Description @@ -1021,7 +1024,7 @@ $fp = fopen("c:\\data\\info.txt", "r"); fputs - write to a file pointer + Write to a file pointer Description @@ -1029,18 +1032,21 @@ $fp = fopen("c:\\data\\info.txt", "r"); int fputs int fp string str - int length + int + + length + + fputs is an alias to - fwrite, and is identical in every way. Note that the - length parameter is optional and if not specified the - entire string will be written. - + fwrite, and is identical in every way. Note + that the length parameter is optional and + if not specified the entire string will be written. + - fread @@ -1058,32 +1064,32 @@ $fp = fopen("c:\\data\\info.txt", "r"); length bytes from the file pointer referenced by fp. Reading stops when length bytes have been read or EOF is - reached, whichever comes first. - + reached, whichever comes first. + - - + + // get contents of a file into a string $filename = "/usr/local/something.txt"; -$fd = fopen( $filename, "r" ); -$contents = fread( $fd, filesize( $filename ) ); -fclose( $fd ); +$fd = fopen ($filename, "r"); +$contents = fread ($fd, filesize ($filename)); +fclose ($fd); - - + + See also fwrite, fopen, fsockopen, popen, fgets, fgetss, - file, and fpassthru. + file, and fpassthru. + - fseek - seek on a file pointer + Seek on a file pointer Description @@ -1113,11 +1119,10 @@ fclose( $fd ); - ftell - tell file pointer read/write position + Tell file pointer read/write position Description @@ -1127,20 +1132,20 @@ fclose( $fd ); Returns the position of the file pointer referenced by fp; i.e., - its offset into the file stream. - + its offset into the file stream. + - If an error occurs, returns false. - + If an error occurs, returns false. + The file pointer must be valid, and must point to a file successfully opened by fopen or - popen. - - See also fopen, - popen, fseek and - rewind. - + popen. + + + See also fopen, popen, + fseek and rewind. + @@ -1155,7 +1160,11 @@ fclose( $fd ); int fwrite int fp string string - int length + int + + length + + fwrite writes the contents of @@ -1164,25 +1173,29 @@ fclose( $fd ); argument is given, writing will stop after length bytes have been written or the end of string is reached, whichever comes - first. - + first. + Note that if the length argument is given, - then the magic_quotes_runtime + then the magic_quotes_runtime configuration option will be ignored and no slashes will be - stripped from string. - + stripped from string. + See also fread, fopen, fsockopen, popen, and - fputs. + fputs. + set_file_buffer - Sets file buffering on the given file pointer + + Sets file buffering on the given file pointer + Description @@ -1194,26 +1207,28 @@ fclose( $fd ); set_file_buffer sets the buffering for write operations on the given filepointer fp to - buffer bytes. If buffer - is 0 then write operations are unbuffered. - - - The function returns 0 on success, or EOF if the request cannot - be honored. - - - Note that the default for any fopen with calling set_file_buffer - is 8K. - + buffer bytes. If + buffer is 0 then write operations are + unbuffered. + - See also fopen. + The function returns 0 on success, or EOF if the request cannot + be honored. + + + Note that the default for any fopen with calling set_file_buffer + is 8K. + + + See also fopen. + is_dir - tells whether the filename is a directory + Tells whether the filename is a directory Description @@ -1222,19 +1237,23 @@ fclose( $fd ); string filename - Returns true if the filename exists and is a directory. + Returns true if the filename exists and is a directory. + The results of this function are cached. See - clearstatcache for more details. + clearstatcache for more details. + - See also is_file and is_link. + See also is_file and + is_link. + is_executable - tells whether the filename is executable + Tells whether the filename is executable Description @@ -1243,19 +1262,25 @@ fclose( $fd ); string filename - Returns true if the filename exists and is executable. + Returns true if the filename exists and is executable. + The results of this function are cached. See - clearstatcache for more details. + clearstatcache for more details. + - See also is_file and is_link. + See also is_file and + is_link. + is_file - tells whether the filename is a regular file + + Tells whether the filename is a regular file + Description @@ -1264,19 +1289,25 @@ fclose( $fd ); string filename - Returns true if the filename exists and is a regular file. + Returns true if the filename exists and is a regular file. + The results of this function are cached. See - clearstatcache for more details. + clearstatcache for more details. + - See also is_dir and is_link. + See also is_dir and + is_link. + is_link - tells whether the filename is a symbolic link + + Tells whether the filename is a symbolic link + Description @@ -1285,19 +1316,25 @@ fclose( $fd ); string filename - Returns true if the filename exists and is a symbolic link. + Returns true if the filename exists and is a symbolic link. + The results of this function are cached. See - clearstatcache for more details. + clearstatcache for more details. + - See also is_dir and is_file. + See also is_dir and + is_file. + is_readable - tells whether the filename is readable + + Tells whether the filename is readable + Description @@ -1306,23 +1343,27 @@ fclose( $fd ); string filename - Returns true if the filename exists and is readable. + Returns true if the filename exists and is readable. + Keep in mind that PHP may be accessing the file as the user id that the web server runs as (often 'nobody'). Safe mode - limitations are not taken into account. + limitations are not taken into account. + The results of this function are cached. See - clearstatcache for more details. + clearstatcache for more details. + - See also is_writeable. + See also is_writeable. + is_writeable - tells whether the filename is writeable + Tells whether the filename is writeable Description @@ -1331,22 +1372,25 @@ fclose( $fd ); string filename - Returns true if the filename exists and is writeable. The filename - argument may be a directory name allowing you to check if a - directory is writeable. + Returns true if the filename exists and is writeable. The + filename argument may be a directory name allowing you to check + if a directory is writeable. + - Keep in mind that PHP may be accessing the file as the user - id that the web server runs as (often 'nobody'). Safe mode - limitations are not taken into account. + Keep in mind that PHP may be accessing the file as the user id + that the web server runs as (often 'nobody'). Safe mode + limitations are not taken into account. + The results of this function are cached. See - clearstatcache for more details. + clearstatcache for more details. + - See also is_readable. + See also is_readable. + - link @@ -1362,8 +1406,10 @@ fclose( $fd ); Link creates a hard link. - See also the symlink to create soft links, - and readlink along with linkinfo. + See also the symlink to create soft links, + and readlink along with + linkinfo. + @@ -1379,22 +1425,24 @@ fclose( $fd ); string path - Linkinfo returns the st_dev field of the UNIX C - stat structure returned by the lstat system call. This - function is used to verify if a link (pointed to by path) - really exists (using the same method as the S_ISLNK macro defined in stat.h). - Returns 0 or FALSE in case of error. + Linkinfo returns the st_dev field of the + UNIX C stat structure returned by the lstat system call. This + function is used to verify if a link (pointed to by + path) really exists (using the same method + as the S_ISLNK macro defined in stat.h). Returns 0 or FALSE in + case of error. + - See also symlink, link, - and readlink. + See also symlink, link, + and readlink. + - mkdir - make directory + Make directory Description @@ -1404,29 +1452,30 @@ fclose( $fd ); int mode - Attempts to create the directory specified by pathname. - + Attempts to create the directory specified by pathname. + Note that you probably want to specify the mode as an octal number, which means it should have a leading zero. - -mkdir("/path/to/my/dir", 0700); - - + + +mkdir ("/path/to/my/dir", 0700); + + + - Returns true on success and false on failure. - + Returns true on success and false on failure. + - See also rmdir. - + See also rmdir. + - pclose - close process file pointer + Close process file pointer Description @@ -1434,21 +1483,28 @@ mkdir("/path/to/my/dir", 0700); int pclose int fp - Closes a file pointer to a pipe opened by popen. - The file pointer must be valid, and must have been returned by a - successful call to popen. - Returns the termination status of the process that was run. - - See also popen. - + + Closes a file pointer to a pipe opened by + popen. + + + The file pointer must be valid, and must have been returned by a + successful call to popen. + + + Returns the termination status of the process that was + run. + + + See also popen. + - popen - open process file pointer + Open process file pointer Description @@ -1457,74 +1513,90 @@ mkdir("/path/to/my/dir", 0700); string command string mode - Opens a pipe to a process executed by forking the command - given by command. - - Returns a file pointer identical to that returned by - fopen, except that it is unidirectional - (may only be used for reading or writing) and must be closed with - pclose. This pointer may be used - with fgets, fgetss, and - fputs. - + + Opens a pipe to a process executed by forking the command given + by command. + + + Returns a file pointer identical to that returned by + fopen, except that it is unidirectional (may + only be used for reading or writing) and must be closed with + pclose. This pointer may be used with + fgets, fgetss, and + fputs. + - If an error occurs, returns false. - + If an error occurs, returns false. + - - $fp = popen( "/bin/ls", "r" ); - + +$fp = popen ("/bin/ls", "r"); + + + - See also pclose. - + See also pclose. + - readfile - output a file + Output a file Description int readfile string filename - int use_include_path + int + + use_include_path + + - Reads a file and writes it to standard output. + Reads a file and writes it to standard output. + Returns the number of bytes read from the file. If an error occurs, false is returned and unless the function was called as - @readfile, an error message is printed. + @readfile, an error message is printed. + If filename begins with "http://" (not case sensitive), an HTTP 1.0 connection is opened to the specified server and the text of the response is written to - standard output. + standard output. + Does not handle HTTP redirects, so you must include trailing - slashes on directories. + slashes on directories. + If filename begins with "ftp://" (not case sensitive), an ftp connection to the specified server is opened and the requested file is written to standard output. If the server - does not support passive mode ftp, this will fail. + does not support passive mode ftp, this will fail. + If filename begins with neither of these strings, the file will be opened from the filesystem and - its contents written to standard output. + its contents written to standard output. + You can use the optional second parameter and set it to "1", if - you want to search for the file in the include_path, too. + you want to search for the file in the include_path, too. + - See also fpassthru, file, - fopen, include, - require, and virtual. - + See also fpassthru, + file, fopen, + include, require, and + virtual. + @@ -1540,18 +1612,22 @@ mkdir("/path/to/my/dir", 0700); string path - Readlink does the same as the readlink C function - and returns the contents of the symbolic link path or 0 in case of error. + Readlink does the same as the readlink C + function and returns the contents of the symbolic link path or 0 + in case of error. + - See also symlink, - readlink and linkinfo. + See also symlink, + readlink and + linkinfo. + rename - rename a file + Rename a file Description @@ -1560,17 +1636,20 @@ mkdir("/path/to/my/dir", 0700); string oldname string newname - Attempts to rename oldname to newname. - Returns true on success and false on failure. - + + Attempts to rename oldname to + newname. + + + Returns true on success and false on failure. + - rewind - rewind the position of a file pointer + Rewind the position of a file pointer Description @@ -1578,14 +1657,16 @@ mkdir("/path/to/my/dir", 0700); int rewind int fp - Sets the file position indicator for fp to the - beginning of the file stream. - If an error occurs, returns 0. - The file pointer must be valid, and must point to a file - successfully opened by fopen. - - See also fseek and ftell. - + + Sets the file position indicator for fp to the beginning of the + file stream. If an error occurs, returns 0. + The file pointer must be valid, and must point to a file + successfully opened by fopen. + + + See also fseek and + ftell. + @@ -1593,7 +1674,7 @@ mkdir("/path/to/my/dir", 0700); rmdir - remove directory + Remove directory Description @@ -1601,21 +1682,24 @@ mkdir("/path/to/my/dir", 0700); int rmdir string dirname - Attempts to remove the directory named by pathname. The - directory must be empty, and the relevant permissions must permit - this. - If an error occurs, returns 0. - - See also mkdir. - + + Attempts to remove the directory named by pathname. The directory + must be empty, and the relevant permissions must permit. + this. + + + If an error occurs, returns 0. + + + See also mkdir. + - stat - give information about a file + Give information about a file Description @@ -1647,16 +1731,17 @@ mkdir("/path/to/my/dir", 0700); systems (i.e. Windows) return -1 The results of this function are cached. See - clearstatcache for more details. - + clearstatcache for more details. + - lstat - give information about a file or symbolic link + + Give information about a file or symbolic link + Description @@ -1665,11 +1750,13 @@ mkdir("/path/to/my/dir", 0700); string filename - Gathers the statistics of the file or symbolic link named by filename. - This function is identical to the stat function - except that if the filename parameter is a - symbolic link, the status of the symbolic link is returned, not - the status of the file pointed to by the symbolic link. + Gathers the statistics of the file or symbolic link named by + filename. This function is identical to the + stat function except that if the + filename parameter is a symbolic link, the + status of the symbolic link is returned, not the status of the + file pointed to by the symbolic link. + Returns an array with the statistics of the file with the following elements: @@ -1691,12 +1778,11 @@ mkdir("/path/to/my/dir", 0700); systems (i.e. Windows) return -1 The results of this function are cached. See - clearstatcache for more details. - + clearstatcache for more details. + - symlink @@ -1712,15 +1798,16 @@ mkdir("/path/to/my/dir", 0700); symlink creates a symbolic link from the existing target with - the specified name link. + the specified name link. + See also link to create hard links, and readlink along with - linkinfo. + linkinfo. + - tempnam @@ -1735,9 +1822,9 @@ mkdir("/path/to/my/dir", 0700); Creates a unique temporary filename in the specified directory. - If the directory does not exist, tempnam - may generate a filename in the system's temporary directory. - + If the directory does not exist, tempnam may + generate a filename in the system's temporary directory. + The behaviour of the tempnam function is system dependent. On Windows the TMP environment variable will @@ -1745,25 +1832,25 @@ mkdir("/path/to/my/dir", 0700); TMPDIR environment variable has precedence, while SVR4 will always use your dir parameter if the directory it points to exists. Consult your system documentation on the - tempnam(3) function if in doubt. - + tempnam(3) function if in doubt. + Returns the new temporary filename, or the null string on failure. - - tempnam() example - -$tmpfname = tempnam( "/tmp", "FOO" ); - - + + <function>Tempnam</function> example + +$tmpfname = tempnam ("/tmp", "FOO"); + + + - touch - set modification time of file + Set modification time of file Description @@ -1775,21 +1862,21 @@ $tmpfname = tempnam( "/tmp", "FOO" ); Attempts to set the modification time of the file named by filename to the value given by time. If the option time is not - given, uses the present time. - + given, uses the present time. + - If the file does not exist, it is created. - + If the file does not exist, it is created. + - Returns true on success and false otherwise. - + Returns true on success and false otherwise. + umask - changes the current umask + Changes the current umask Description @@ -1798,11 +1885,14 @@ $tmpfname = tempnam( "/tmp", "FOO" ); int mask - Umask sets PHP's umask to mask & 0777 and returns the - old umask. When PHP is being used as a server module, the umask is restored - when each request is finished. + Umask sets PHP's umask to mask & 0777 and + returns the old umask. When PHP is being used as a server module, + the umask is restored when each request is finished. + - Umask without arguments simply returns the current umask. + Umask without arguments simply returns the + current umask. + @@ -1818,12 +1908,15 @@ $tmpfname = tempnam( "/tmp", "FOO" ); string filename - Deletes filename. Similar to the Unix C unlink() function. + Deletes filename. Similar to the Unix C + unlink() function. + - Returns 0 or FALSE on an error. + Returns 0 or FALSE on an error. + - See also rmdir for removing directories. - + See also rmdir for removing directories. +