API16

API16:JFile/getName

From Joomla! Documentation

Revision as of 22:38, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Returns the name, sans any path <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

Returns the name, sans any path

[Edit Descripton]

Template:Description:JFile/getName

Syntax

getName($file)
Parameter Name Default Value Description
$file

Returns

string filename

Defined in

libraries/joomla/filesystem/file.php

Importing

jimport( 'joomla.filesystem.file' );

Source Body

function getName($file) {
        $slash = strrpos($file, DS);
        if ($slash !== false) {
                return substr($file, $slash + 1);
        } else {
                return $file;
        }
}

[Edit See Also] Template:SeeAlso:JFile/getName

Examples

<CodeExamplesForm />