bigthink Posted October 28, 2006 Share Posted October 28, 2006 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.phpHow 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 https://forums.phpfreaks.com/topic/25408-how-can-i-delete-the-php-in-my-echo-statement/ Share on other sites More sharing options...
bigthink Posted October 28, 2006 Author Share Posted October 28, 2006 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 https://forums.phpfreaks.com/topic/25408-how-can-i-delete-the-php-in-my-echo-statement/#findComment-115923 Share on other sites More sharing options...
bigthink Posted October 28, 2006 Author Share Posted October 28, 2006 Nevermind...still looking for an anwer. :(That just gives me part of the page title. What in the heck?Anyone have an answer that works? :) Link to comment https://forums.phpfreaks.com/topic/25408-how-can-i-delete-the-php-in-my-echo-statement/#findComment-115933 Share on other sites More sharing options...
Skatecrazy1 Posted October 28, 2006 Share Posted October 28, 2006 wow this is simple. don't make posts every 10 minutes just because you haven't gotten an answer yet. try something like this.[code]<?php$string = "filename.php";$string = rtrim($string, ".php");echo $string;?>[/code]i tested that and it worked. Link to comment https://forums.phpfreaks.com/topic/25408-how-can-i-delete-the-php-in-my-echo-statement/#findComment-115938 Share on other sites More sharing options...
brendandonhue Posted October 28, 2006 Share Posted October 28, 2006 Or[code=php:0]$string = basename('filename.php', '.php');[/code] Link to comment https://forums.phpfreaks.com/topic/25408-how-can-i-delete-the-php-in-my-echo-statement/#findComment-115996 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.