#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Hong Kong
    Posts
    73
    Rep Power
    15
    i have a PHP file say 'test.php'.
    i want it be able to find out its filename.
    and print it on screen.

    anyone know how to do it?
    eg.
    execuing 'test.php'...

    <output>
    test.php

  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    Perth West Australia
    Posts
    757
    Rep Power
    15
    <?php echo $PHP_SELF;?>

    ------------------
    Simon Wheeler
    FirePages -DHTML/PHP/MySQL
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Hong Kong
    Posts
    73
    Rep Power
    15
    yep!
    thx firepage
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Hong Kong
    Posts
    73
    Rep Power
    15
    ack

    firepage..
    the $PHP_SELF contains the path of the file.
    i want the filename only.

    I know it can be done by using explode() functions...
    but is there another $PHPxxxx for showing filename only?
  8. #5
  9. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    Perth West Australia
    Posts
    757
    Rep Power
    15
    Do not think? there is a function that just supplies the file name sorry! - it looks like regex or substr() is the next step! - regex will be easy if you know what the path will be - or how long the file name is - hopefully I am wrong and somebody else will post an answer.

    Simon

    ------------------
    Simon Wheeler
    FirePages -DHTML/PHP/MySQL
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Hong Kong
    Posts
    73
    Rep Power
    15
    hehe
    i have solved the problem by using two explode() functions
    thx for your reply firepages!

Similar Threads

  1. How to read multiple line text file into a variable
    By gatewaycityca in forum Visual Basic Programming
    Replies: 4
    Last Post: January 29th, 2004, 01:26 PM
  2. Replies: 4
    Last Post: January 11th, 2004, 12:34 PM
  3. replication: distributing read operations
    By JunkCookie in forum MySQL Help
    Replies: 3
    Last Post: December 10th, 2003, 03:22 AM
  4. Python programing newbie needs help
    By SuperDude in forum Python Programming
    Replies: 15
    Last Post: December 6th, 2003, 12:14 PM
  5. read linux file with php
    By gamers in forum PHP Development
    Replies: 1
    Last Post: December 6th, 2003, 08:57 AM

IMN logo majestic logo threadwatch logo seochat tools logo