PHP Function Reference

PHP streamWrapper url_stat() Method

The PHP streamWrapper::url_stat() method retrieves information about a file. This method is called in response to all stat() related functions, such as:


public streamWrapper::url_stat(path, flags)



Required. Specify the file path or URL to stat.

Note: In the case of a URL, it must be a :// delimited URL. Other URL forms are not supported.
flags Required. Specify additional flags set by the streams API. It can hold one or more of the following values OR'd together:
  • STREAM_URL_STAT_LINK - For resources with the ability to link to other resource (such as an HTTP Location: forward, or a filesystem symlink). This flag specified that only information about the link itself is returned, not the resource pointed to by the link. This flag is set in response to calls to lstat(), is_link(), or filetype().
  • STREAM_URL_STAT_QUIET - If this flag is set, the wrapper do not raise any errors. If this flag is not set, you are responsible for reporting errors using the trigger_error() function during stating of the path.

Return Value

Returns an array with the same elements as stat() function. Unknown or unavailable values is set to a rational value (usually 0). Returns false on failure.


Emits E_WARNING if call to this method fails (i.e. not implemented).

Note: The streamWrapper::$context property is updated if a valid context is passed to the caller function.

❮ PHP Streams Reference