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

Where can I find php ini file?

496


What is printf in php?

527


Tell me how to create a text file in php?

548


What is abstraction php?

529


Explain Booleans in PHP?

630






What are objects in php?

525


Where is the submitted form data stored?

571


Are php variables global?

555


Does cors prevent csrf?

529


Is salary a ratio or interval?

549


How many keywords are there in php?

616


Who is the father of php and what is the current version of php and mysql?

687


Which functions are used to count the total number of array elements in php?

539


What is filter_var?

536


Tell me how can I display text with a php script?

516