which function used to get the file name in php?

Answer Posted / nilsoft

Method 1.
$file = trim($_SERVER["SCRIPT_NAME"],'/');
Method 2.
$file =
substr($_SERVER["SCRIPT_NAME"],1,strlen($_SERVER["SCRIPT_NAME"])-1);
Method 3.
$file = str_replace('/','',$_SERVER["SCRIPT_NAME"]);
Method 4.
$file = basename($_SERVER["SCRIPT_NAME"]);

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do you know how can we check the value of a given variable is a number?

515


Is a number php?

524


Can you use php and javascript together?

555


Do you know what is the use of rand() in php?

538


What is the difference between Session and Cookie?

579






How to get length of an array in PHP?

563


Do you know design patterns. List few?

530


Why shouldn't I use mysql_* functions in php?

580


How can I increase my website session?

535


What is the purpose of pear in php?

579


Which is better get or post method?

453


What is session and why do we use it?

550


What is the use of is_array() and in_array()?

539


What is a php form?

537


What is a closure in php?

533