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

How to convert strings in hex format?

1086


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

1086


Can age be a variable?

1008


What are the design patterns in php?

1050


Does php require a web server?

1020


What is the use of dual table in mysql?

1016


How to find a substring from a given string in php?

1107


How can you retrieve a cookie value?

1153


Do you know what is the difference between the include() and require() functions?

1032


How do I escape in php?

1065


How to retrieve values out of an array?

1102


Can we use session in mvc?

1047


How do I repair phpmyadmin?

1008


What is the best php framework 2018?

1060


write a note on Testing the web site

1917