Currently, two sets of built-in arrays contain the same information. One set of arrays, introduced in PHP 4.1.0, are called superglobals or autoglobals because they can be used anywhere, even inside a function. The older arrays, with long names such as $HTTP_SERVER_VARS, must be made global before they can be used in an array. Unless you’re using an old version of PHP, use the newer arrays, those whose names begin with an underscore (_). The older arrays should be used only when you’re forced to use a version of PHP older than PHP 4.1.0.
A new php.ini setting introduced in PHP 5 allows you to prevent PHP from automatically creating the older, long arrays. It’s very unlikely that you will need to use them, unless you’re using some old scripts containing the long variables. The following line in php.ini controls this setting:
register_long_arrays = On
At the current time, this setting is On by default. Unless you’re running old scripts that need the old arrays, you should change the setting to Off so that PHP doesn’t do this extra work.
Although the setting is currently On by default, that could change. The default setting might change to Off in a future version. If you’re using some old scripts and getting errors on lines containing the long arrays, such as $HTTP_GET_ VARS, check your php.ini setting for long arrays. It might be Off, and the long arrays needed by the older script are not being created at all.
The built-in arrays are listed in Table 6-2, along with a short description. The use of specific arrays is described in detail in this book where the related subjects are described.

0 comments:
Post a Comment