SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2007
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What is register globals

    I have read register globals will not be available in PHP6. Does it mean we'll not be able to use such type of code
    PHP Code:
    function a()
    {
        global 
    $b;
        
    $b 10;
    }

    a();
    echo 
    $b
    OR

    We'll be unable to receive get/post/cookie/session values using global?

    To experiment this, I have disabled register_globals in phpi.ini and run the 1st code. But can easily get the value of $b. Now I am confused by the term register globals.

  2. #2
    SitePoint Evangelist
    Join Date
    Aug 2005
    Posts
    453
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Read the online docs @ : http://us2.php.net/register_globals
    Computers and Fire ...
    In the hands of the inexperienced or uneducated,
    the results can be disastrous.
    While the professional can tame, master even conquer.

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2007
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the link. I have read it. But can you answer, will this change affect the keyword global as I used in the function?

  4. #4
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, register_globals has nothing to do with "global" keyword.

  5. #5
    SitePoint Enthusiast GhostGambler's Avatar
    Join Date
    Apr 2007
    Location
    Germany, NRW
    Posts
    84
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    register_globals only affects the registration of request variables into the global scope.

    Besides, using the keyword global is bad practice, so you should erase this one though~


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •