PHP Basename


the basename() function is used to return a basic file name in a string containing the full path, returning the string successfully, otherwise returning FALSE.

grammar:

string basename(string path[, string suffix])

The optional parameter suffix represents the suffix of the file. If the suffix suffix is suffix, then this part will also be removed.

example:

Assuming the local access to the file URL address: http:// 127.0.0.1/html/test.php

echo $PHP_SELF; // Output: /html/test.php
echo basename($PHP_SELF); // Output: test.php
echo basename($PHP_SELF, '.php'); // Output: test



Copyright 2014-2017 by DeveloperTut.com. All Rights Reserved.
TwitterGoogle+Facebook