Thread: Variable Name

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

    Join Date
    Apr 2000
    Hong Kong
    Rep Power
    Can I get the variable name in PHP?

    eg. $abc="100";

    I want to get the name of variable ($abc), i need to get the string "abc". Can I do it?
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    New Delhi,India
    Rep Power
    As far as getting the varibale name $abc is concerned i do not think there should be any problem..u can get the string stored in it.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Pune, Maharashtra, India
    Rep Power
    I dont think the is any way we can get the variable name from the value in PHP. If somebody comes up with real answer please inform me to.
  6. #4
  7. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Rep Power

    I want to get the name of variable ($abc), i need to get the string "abc". Can I do it?

    yes,but i think you may not get any function support for this.but if you want to get some variable names from form then it is possible using $HTTP_POST_VARS(see the manual for details).

    The above variable name you can get very easily..

    echo substr("$test",1);

    //returns the variable name.make sure that '' slash is thier before variable.

    //it will print 'test'

    i don't know wether using some function you can achive samething..

    Good Luck!!!

    SR - Career Portal

    "The fear of the LORD is the beginning of knowledge..."

    [This message has been edited by Shiju Rajan (edited August 14, 2000).]

Similar Threads

  1. Replies: 4
    Last Post: February 13th, 2004, 03:31 PM
  2. A variable $_POST variable?
    By CLuver in forum PHP Development
    Replies: 0
    Last Post: February 11th, 2004, 12:55 AM
  3. How to read multiple line text file into a variable
    By gatewaycityca in forum Visual Basic Programming
    Replies: 4
    Last Post: January 29th, 2004, 12:26 PM
  4. Replies: 5
    Last Post: November 16th, 2003, 11:31 AM
  5. How to grab Javascript form variable into a PHP Variable
    By dfroehli in forum JavaScript Development
    Replies: 3
    Last Post: October 1st, 2003, 08:21 PM

IMN logo majestic logo threadwatch logo seochat tools logo