05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Attempts to lock the file path of the file specified by handle. The operation is one of the<br />

following values:<br />

If specified, would_block is set to true if the operation would cause a block on the file. The<br />

function returns false if the lock could not be obtained, and true if the operation<br />

succeeded.<br />

Because file locking is implemented at the process level on most systems, flock( ) cannot<br />

prevent two <strong>PHP</strong> scripts running in the same web server process from accessing a file at the<br />

same time.<br />

floor<br />

double floor(double number)<br />

Returns the largest integer value less than or equal to number.<br />

flush<br />

void flush( )<br />

Sends the current output buffer to the client and empties the output buffer. See Chapter 13<br />

for more information on using the output buffer.<br />

fopen<br />

LOCK_SH Shared lock (reader)<br />

LOCK_EX Exclusive lock (writer)<br />

LOCK_UN Release a lock (either shared or exclusive)<br />

LOCK_NB Add to LOCK_SH or LOCK_EX to obtain a non-blocking lock<br />

int fopen(string path, string mode[, bool include])<br />

Opens the file specified by path and returns a file resource handle to the open file. If path<br />

begins with http://, an HTTP connection is opened and a file pointer to the start of the<br />

response is returned. If path begins with ftp://, an FTP connection is opened and a file<br />

pointer to the start of the file is returned; the remote server must support passive FTP.<br />

If path is php://stdin, php://stdout, or php://stderr, a file pointer to the appropriate<br />

stream is returned.<br />

The parameter mode specifies the permissions to open the file with. It must be one of the<br />

following:<br />

r Open the file for reading; file pointer will be at beginning of file.<br />

r+ Open the file for reading and writing; file pointer will be at beginning of<br />

file.<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2002 O’Reilly & Associates, Inc. All rights reserved.<br />

fopen | 401

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!