From 709d4139c84f6764eb5f8b9550db3f371416936d Mon Sep 17 00:00:00 2001 From: Mike Ford Date: Thu, 28 Jul 2011 15:09:43 +0000 Subject: [PATCH] Clarify purpose of options parameter, be more explicit about return values; extra example; miscellaneous tidy ups. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@313876 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/filesystem/functions/pathinfo.xml | 61 ++++++++++++++++----- 1 file changed, 48 insertions(+), 13 deletions(-) diff --git a/reference/filesystem/functions/pathinfo.xml b/reference/filesystem/functions/pathinfo.xml index 97733ab6ea..aa71fc339c 100644 --- a/reference/filesystem/functions/pathinfo.xml +++ b/reference/filesystem/functions/pathinfo.xml @@ -14,8 +14,9 @@ intoptionsPATHINFO_DIRNAME | PATHINFO_BASENAME | PATHINFO_EXTENSION | PATHINFO_FILENAME - pathinfo returns an associative array - containing information about path. + pathinfo returns information about + path: either an associative array or a string, + depending on options. @@ -27,7 +28,7 @@ path - The path being checked. + The path to be parsed. @@ -35,13 +36,14 @@ options - You can specify which elements are returned with optional parameter - options. It composes from + If present, specifies a specific element to be returned; one of PATHINFO_DIRNAME, PATHINFO_BASENAME, - PATHINFO_EXTENSION and - PATHINFO_FILENAME. It - defaults to return all elements. + PATHINFO_EXTENSION or + PATHINFO_FILENAME. + + If options is not specified, returns all + available elements. @@ -52,13 +54,22 @@ &reftitle.returnvalues; - The following associative array elements are returned: + If the options parameter is not passed, an + associative array containing the following elements is + returned: dirname, basename, extension (if any), and filename. + + + If the path does not have an extension, no + extension element will be returned + (see second example below). + + - If options is used, this function will return a - string if not all elements are requested. + If options is present, returns a + string containing the requested element. @@ -110,6 +121,30 @@ echo $path_parts['filename'], "\n"; // since PHP 5.2.0 lib.inc.php php lib.inc +]]> + + + + + + <function>pathinfo</function> example showing difference between null and no extension + + +]]> + + &example.outputs.similar; + + @@ -127,8 +162,8 @@ lib.inc - pathinfo is locale aware, so for it to parse the path - correctly with multibyte character, the matching locale must be set using + pathinfo is locale aware, so for it to parse a path + containing multibyte characters correctly, the matching locale must be set using the setlocale function.