Home / Uncategorized / Get Current File Name using PHP

Get Current File Name using PHP

Difference between basename(__FILE__, ".php") and basename($_SERVER['REQUEST_URI'], ".php").

1): basename(__FILE__, ".php") shows the name of the file where this code is included – It means that if you include this code in header.php and current page is index.php, it will return header not index.

2): basename($_SERVER["REQUEST_URI"], ".php") – If you use include this code in header.php and current page is index.php, it will return index not header.

Leave a Reply

Your email address will not be published. Required fields are marked *