<?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.12 $ --> <!-- 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> if any. </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>, <constant>PATHINFO_EXTENSION</constant> and <constant>PATHINFO_FILENAME</constant> (available since PHP 5.2.0). 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"; echo $path_parts['filename'], "\n"; // since PHP 5.2.0 ?> ]]> </programlisting> <para> Would produce: </para> <screen> <![CDATA[ /www/htdocs index.html html index ]]> </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 -->