Re: [PHP] Get filename in php command line

2001-07-17 Thread Jason Bell
$PHP_SELF returns the filename with the full path. from there, you can use split to split the string wherever a / occurs, then call count, to get the total number of values in the array, decrememnt the count by 1 (Arrays begin at 0) then, set a variable to store just the filename, like so:

Re: [PHP] Get filename in php command line

2001-07-17 Thread Reuben D Budiardja
Seems that $PHP_SELF is not defined when it's run from the command line. Reuben D. Budiardja On Tuesday 17 July 2001 10:29 am, Jason Bell wrote: $PHP_SELF returns the filename with the full path. from there, you can use split to split the string wherever a / occurs, then call count, to get

RE: [PHP] Get filename in php command line

2001-07-17 Thread Boget, Chris
Seems that $PHP_SELF is not defined when it's run from the command line. Try: __FILE__ Chris

Re: [PHP] Get filename in php command line

2001-07-17 Thread Reuben D Budiardja
I had that before. OK, seems that my problem is not that simple. The thing is , I have something like this in my file test.php: require('my_api.inc'); echo This is test.php3; Now, in my_api.inc, I want to know that I run test.php3, when I do bash$ php test.php3 and the filename is test.php3

RE: [PHP] Get filename in php command line

2001-07-17 Thread Boget, Chris
I had that before. OK, seems that my problem is not that simple. The thing is , I have something like this in my file test.php: require('my_api.inc'); echo This is test.php3; Now, in my_api.inc, I want to know that I run test.php3, when I do bash$ php test.php3 and the filename is

Re: [PHP] Get filename in php command line

2001-07-17 Thread Reuben D Budiardja
On Tuesday 17 July 2001 11:14 am, Boget, Chris wrote: in my_api.inc, have the following code: echo Currently Running file is: ; echo ( $CurrentRunningFile ) ? $CurrentRunningFile : __FILE__; in test.php ? $CurrentRunningFile = __FILE__; include( my_api.inc ); echo This is