1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Global Buffering Space On Server

Discussion in 'PHP' started by jaguarx, Sep 22, 2009.

  1. #1
    I'm developing an e-commerce site involved with a lot of database access and naturally I want to keep the DB access to a minimum. Keeping some information in a server buffer definitely helps. I do have about 10 PHP script files for the entire site. Do you know if variables declared outside of functions in PHP modules are considered as global variables and accessible from any executing PHP scripts? Thanks,


    Warren
     
    jaguarx, Sep 22, 2009 IP
  2. Chemo

    Chemo Peon

    Messages:
    146
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Each request for a PHP script is executed in a pristine VM. There is not a native method for stateful preservation of values between requests except persistence such as databases, memcached, APC, etc.

    To directly answer your question: global variables are only accessible to the main execution of the byte code compiled scripts which are needed for for the individual request. They are not shared between requests.
     
    Chemo, Sep 24, 2009 IP