FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP script to get name of file which houses the script?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: PHP script to get name of file which houses the script? [message #185007 is a reply to message #184997] Sun, 23 February 2014 21:00 Go to previous messageGo to previous message
Robert Heller is currently offline  Robert Heller
Messages: 60
Registered: December 2010
Karma:
Member
At Sun, 23 Feb 2014 11:47:04 -0800 (PST) rnetzlof(at)gmail(dot)com wrote:

>
> I have a number of files which contain PHP scripts like:
>
> <?php
> $file_name='mtg10.php';
> include 'format_date.php';
> ?>

<?php
/* __FILE__ is the full pathname of the current file. basename() returns
* the tail.
*/
$file_name=basename(__FILE__);
include 'format_date.php';
?>

>
> The included PHP script uses $file_name to get the last uploaded time stamp of the named file and process it into a displayable line. All that works as intended.
>
> What I don't like is the need for $file_name='mtg10.php'; It would be much handier if I could write something like $file_name=getNameOfThisFile(); instead.
>
> I've looked, can't find any such function, but maybe I haven't looked in the right references. Is there such a function or a sequence of function calls to produce that effect?
>
> Bob Netzlof
>

--
Robert Heller -- 978-544-6933 / heller(at)deepsoft(dot)com
Deepwoods Software -- http://www.deepsoft.com/
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Help with regex
Next Topic: JavaScript to PHP
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 22:35:50 GMT 2024

Total time taken to generate the page: 0.05270 seconds