Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How can I get the only name of the current executing file?

Answer Posted / nilsoft

There are too many solutions. But i am showing 4 among them

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"]);

and so on............

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is query string php?

978


What is == and === in php?

908


Does php have multiple inheritance?

998


Give the case where we can use get and we can use post methods?

1039


Tell us how can we display the output directly to the browser?

1036


What is php mainly used for?

985


Is php good for career?

997


What is the capacity of mysql database?

1080


What is string in php?

991


How to assigning a new character in a string?

1110


How to specify argument default values?

976


Write a php script to get the largest key in an array?

1029


How do you trim spaces in excel?

1024


What is composer json?

913


How to get a total number of rows available in the table?

981