API16

API16:JFile/getName

From Joomla! Documentation

Revision as of 01:39, 25 March 2017 by JoomlaWikiBot (talk | contribs) (preparing for archive only)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

Returns the name, sans any path


<! removed transcluded page call, red link never existed >

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;
        }
}


<! removed transcluded page call, red link never existed >

Examples

Code Examples