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

    Join Date
    Sep 2000
    Location
    france
    Posts
    35
    Rep Power
    14
    Hi !

    I've problems including global variables in my functions... (pbbly because I don't know )

    for instance, how do I extract $REMOTE_ADDR, or a session variable, inside a function ?

    Thanx

    -
    J0f
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2000
    Posts
    669
    Rep Power
    15
    Well, in your function if you want to use a global variable you just need to declare it as being global. So if you wanted to use $PHP_SELF in your function you would just use the following

    function test_function() {
    global $PHP_SELF;
    proocess function as normal with $PHP_SELF being available to you
    }

  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    73
    Rep Power
    15
    Or use $GLOBALS["valname"]
    or passing arguments in, the function will create a copy of them

    ------------------
    http://new.123finder.com/ - Helps you find cool domains for FREE & Registers it for only $14.95/yr
    http://www.guideclick.com/ - Qualified webmaster resources (affiliate programs, web design, tips)

    ------
    Son
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    france
    Posts
    35
    Rep Power
    14
    Thanks guys !

    -
    J0f

    (in fact I'm a ****, I could have read it in the manual ) )

Similar Threads

  1. Passing POST variables
    By rlorenzo in forum PHP Development
    Replies: 11
    Last Post: June 6th, 2004, 02:00 PM
  2. help with assigning variables, variable passing/ retrieval
    By pinkipodmini in forum PHP Development
    Replies: 0
    Last Post: February 13th, 2004, 09:40 PM
  3. Replies: 2
    Last Post: February 10th, 2004, 11:03 PM
  4. functions and variables
    By uniopp in forum PHP Development
    Replies: 7
    Last Post: September 25th, 2003, 09:43 AM
  5. Automatically creating class variables
    By dreamstring in forum PHP Development
    Replies: 1
    Last Post: August 15th, 2003, 09:12 AM

IMN logo majestic logo threadwatch logo seochat tools logo