Jump to content

How Can I Delete the .php in my echo statement?


bigthink

Recommended Posts

Ok, so here's the new problem.  The frustrating thing is I had the answer and then accidentally deleted it!  ARGH.


Anyway this is what I have:

[code] <?
                        $fullpath = $_SERVER["PHP_SELF"];
                        $filename = substr(strrchr($fullpath, "/"), 1);
                        echo $filename

?>[/code]


When it echos the $filename it prints out : pagename.php

How can I echo just "pagename" without the .php tag?

Your help is always appreciated and I'll keep looking in the meantime!

Link to comment
Share on other sites

I think everytime I have a problem I'm just going to immediately come post in here because within minutes of posting I ALWAYS find the answer.

In case you are wondering, too:
[code] <?

                        $clean = explode("/",$_SERVER["SCRIPT_NAME"]);
                        $clean=explode(".",$clean[1]);
                        $clean=$clean[0];
                        echo $clean;


?>[/code]

That will do it again!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.