php-doc-en/reference/filesystem/functions/pathinfo.xml
Nuno Lopes eda42dd013 fix proto (return value)
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@204484 c90b9560-bf6c-de11-be94-00142212c4b1
2006-01-03 19:04:03 +00:00

92 lines
2.6 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.9 $ -->
<!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.61 -->
<refentry id="function.pathinfo">
<refnamediv>
<refname>pathinfo</refname>
<refpurpose>Returns information about a file path</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>pathinfo</methodname>
<methodparam><type>string</type><parameter>path</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
<function>pathinfo</function> returns an associative array
containing information about <parameter>path</parameter>. The
following array elements are returned:
<literal>dirname</literal>, <literal>basename</literal>
and <literal>extension</literal>.
</para>
<para>
You can specify which elements are returned with optional parameter
<parameter>options</parameter>. It composes from
<constant>PATHINFO_DIRNAME</constant>,
<constant>PATHINFO_BASENAME</constant> and
<constant>PATHINFO_EXTENSION</constant>. It defaults to return all
elements. This function returns string if not all elements are requested.
</para>
<para>
<example>
<title><function>pathinfo</function> Example</title>
<programlisting role="php">
<![CDATA[
<?php
$path_parts = pathinfo('/www/htdocs/index.html');
echo $path_parts['dirname'], "\n";
echo $path_parts['basename'], "\n";
echo $path_parts['extension'], "\n";
?>
]]>
</programlisting>
<para>
Would produce:
</para>
<screen>
<![CDATA[
/www/htdocs
index.html
html
]]>
</screen>
</example>
</para>
<note>
<para>
For information on retrieving the current path info, read
the section on <link linkend="language.variables.predefined">
predefined reserved variables</link>.
</para>
</note>
<para>
See also <function>dirname</function>,
<function>basename</function>,
<function>parse_url</function>
and <function>realpath</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->