Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #12900

Re: PHP script to get name of file which houses the script?

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.php
Subject Re: PHP script to get name of file which houses the script?
Date 2014-02-23 20:40 +0000
Organization A noiseless patient Spider
Message-ID <ledmbp$slf$2@dont-email.me> (permalink)
References <ff08231b-69c6-4fe5-b0c1-e9870fe3352f@googlegroups.com>

Show all headers | View raw


On Sun, 23 Feb 2014 11:47:04 -0800, rnetzlof wrote:

> 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.

is this:

$file_name = __FILE__;

what you're looking for?

http://www.php.net/manual/en/language.constants.predefined.php

Make sure you read the manual page before using it, as it's quite likely 
not going to give exactly the same value as "$file_name = 
string_literal;" will.

-- 
Denis McMahon, denismfmcmahon@gmail.com

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

PHP script to get name of file which houses the script? rnetzlof@gmail.com - 2014-02-23 11:47 -0800
  Re: PHP script to get name of file which houses the script? Christian Stadler <stadli@gmx.de> - 2014-02-23 21:30 +0100
  Re: PHP script to get name of file which houses the script? Christoph Michael Becker <cmbecker69@arcor.de> - 2014-02-23 21:34 +0100
  Re: PHP script to get name of file which houses the script? Denis McMahon <denismfmcmahon@gmail.com> - 2014-02-23 20:40 +0000
  Re: PHP script to get name of file which houses the script? Robert Heller <heller@deepsoft.com> - 2014-02-23 15:00 -0600
  Re: PHP script to get name of file which houses the script? rnetzlof@gmail.com - 2014-02-23 13:57 -0800

csiph-web