SHARED HOSTING
   RESELLER HOSTING
   VPS HOSTING
   SEMI-DEDICATED HOSTING
   DEDICATED HOSTING
   DOMAIN REGISTRATION
   MERCHANT ACCOUNTS
   AFFILIATE PROGRAM
 

Jun 20, 2008
Magento Hosting

May 26, 2008
Support for Zend Framework Hosting

 
   

View 3rd Party Uptime Stats
BBBOnline Reliability Seal
RatePoint Site Seal
Green Hosting
HACKER SAFE certified sites prevent over 99.9% of hacker crime.

A2 Hosting Uptime
hosting

A2 Hosting Guarantee
cheap web hosting
 
Using old code with new versions of PHP

Using old code with new versions of PHP

Now that PHP has grown to be a popular scripting language, there are a lot of public repositories and libraries containing code you can reuse. The PHP developers have largely tried to preserve backwards compatibility, so a script written for an older version will run (ideally) without changes in a newer version of PHP. In practice, some changes will usually be needed.

Two of the most important recent changes that affect old code are:

  • The deprecation of the old $HTTP_*_VARS arrays (which need to be indicated as global when used inside a function or method). The following autoglobal arrays were introduced in PHP 4.1.0. They are: $_GET, $_POST, $_COOKIE, $_SERVER, $_FILES, $_ENV, $_REQUEST, and $_SESSION. The older $HTTP_*_VARS arrays, such as $HTTP_POST_VARS, still exist as they have since PHP 3. As of PHP 5.0.0, the long PHP predefined variable arrays may be disabled with the register_long_arrays directive.

  • External variables are no longer registered in the global scope by default. In other words, as of PHP 4.2.0 the PHP directive register_globals is off by default in php.ini. The preferred method of accessing these values is via the autoglobal arrays mentioned above. Older scripts, books, and tutorials may rely on this directive being on. If it were on, for example, one could use $id from the URL http://www.example.com/foo.php?id=42. Whether on or off, $_GET['id'] is available.

For more details on these changes, see the section on predefined variables and links therein.

 

Featured Packages:

Shared Hosting
Small Biz
250 GB Disk Space
250 GB of Data Transfer
Host UNLIMITED Domains
PHP 5.2.6
Apache 2.2
MySQL 5.0.x
PostgreSQL 8.2.x
Ruby on Rails 2.0
SSH/Shell
Subversion/CVS
cPanel
SSL, FTP, Stats
Free Auto-Install Blogs,
Forums, E-Commerce and more!

From $6.95/mo


Reseller Hosting
Starter Reseller
25 GB Disk Space
250 GB of Data Transfer
Host UNLIMITED Domains
PHP 5.2.6
Apache 2.2
MySQL 5.0.x
PostgreSQL 8.2.x
Ruby on Rails 2.0
SSH/Shell
Subversion/CVS
cPanel
SSL, FTP, Stats
Free Auto-Install Blogs,
Forums, E-Commerce and more!

From $17.95/mo

 
 
 
 
Home    About Us    Services    Support    Order Online    Contact    Privacy