If I have PHP script, how can I get the filename of the currently executed file without its extension?
Given the name of a script of the form "jquery.js.php", how can I extract just the "jquery.js" part?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just use the PHP magic constant
__FILE__to get the current filename.But it seems you want the part without
.php. So…A more generic file extension remover would look like this…
Using standard string library functions is much quicker, as you’d expect.