svn: /phpdoc/en/trunk/reference/filesystem/functions/ dirname.xml
| From: | Thomas Punt | Date: | Sun, 16 Aug 2015 18:16:29 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/filesystem/functions/ dirname.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-13611@lists.php.net to get a copy of this message | ||
tpunt Sun, 16 Aug 2015 18:16:29 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=337505
Log:
Document new dirname() changes
Changed paths:
U phpdoc/en/trunk/reference/filesystem/functions/dirname.xml
Modified: phpdoc/en/trunk/reference/filesystem/functions/dirname.xml
===================================================================
--- phpdoc/en/trunk/reference/filesystem/functions/dirname.xml 2015-08-16 17:28:24 UTC (rev 337504)
+++ phpdoc/en/trunk/reference/filesystem/functions/dirname.xml 2015-08-16 18:16:29 UTC (rev 337505)
@@ -3,7 +3,7 @@
<refentry xmlns="http://docbook.org/ns/docbook"
xml:id="function.dirname">
<refnamediv>
<refname>dirname</refname>
- <refpurpose>Returns parent directory's path</refpurpose>
+ <refpurpose>Returns a parent directory's path</refpurpose>
</refnamediv>
<refsect1 role="description">
@@ -11,10 +11,12 @@
<methodsynopsis>
<type>string</type><methodname>dirname</methodname>
<methodparam><type>string</type><parameter>path</parameter></methodparam>
+ <methodparam
choice="opt"><type>int</type><parameter>levels</parameter><initializer>1</initializer></methodparam>
</methodsynopsis>
<para>
- Given a string containing the path of a file or directory,
- this function will return the parent directory's path.
+ Given a string containing the path of a file or directory, this function
+ will return the parent directory's path that is
+ <parameter>levels</parameter> up from the current directory.
</para>
</refsect1>
@@ -35,6 +37,17 @@
</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><parameter>levels</parameter></term>
+ <listitem>
+ <para>
+ The number of parent directories to go up.
+ </para>
+ <para>
+ This must be an integer greater than 0.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
</para>
</refsect1>
@@ -42,7 +55,7 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
- Returns the path of the parent directory. If there are no slashes in
+ Returns the path of a parent directory. If there are no slashes in
<parameter>path</parameter>, a dot ('<literal>.</literal>') is
returned,
indicating the current directory. Otherwise, the returned string is
<parameter>path</parameter> with any trailing
@@ -63,6 +76,12 @@
</thead>
<tbody>
<row>
+ <entry>7.0.0</entry>
+ <entry>
+ Added the optional <parameter>levels</parameter> parameter.
+ </entry>
+ </row>
+ <row>
<entry>5.0.0</entry>
<entry>
<function>dirname</function> is now binary safe
@@ -82,12 +101,21 @@
<programlisting role="php">
<![CDATA[
<?php
-echo "1) " . dirname("/etc/passwd") . PHP_EOL; // 1) /etc
-echo "2) " . dirname("/etc/") . PHP_EOL; // 2) / (or \ on Windows)
-echo "3) " . dirname("."); // 3) .
-?>
+echo dirname("/etc/passwd") . PHP_EOL;
+echo dirname("/etc/") . PHP_EOL;
+echo dirname(".") . PHP_EOL;
+echo dirname("/usr/local/lib", 2);
]]>
</programlisting>
+ &example.outputs.similar;
+ <screen>
+<![CDATA[
+/etc
+/ (or \ on Windows)
+.
+/usr
+]]>
+ </screen>
</example>
</para>
</refsect1>