There are very few articles on how to do this. The main changes are these:
* $HTTP_POST_VARS should become $_POST * $HTTP_GET_VARS => $_GET * $HTTP_COOKIE_VARS => $_COOKIE * $HTTP_SERVER_VARS => $_SERVER * $HTTP_FILES_VARS => $_FILES * $HTTP_ENV_VARS => $_ENV * $HTTP_REQUEST_VARS => $_REQUEST * $HTTP_SESSION_VARS => $_SESSION
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 and 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.
Also, 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
I think to fix this, use:
But here I'm not sure if you would have to check $_GET and $_POST, e.g.
$joe = new Person(); $joe->sex = 'male'; $betty = $joe; $betty->sex = 'female'; echo $joe->sex; // Will be 'female'
Note that this also means you can stop using the reference operator (&). It was common practice to pass your objects around using the & operator to get around the annoying pass-by-value functionality in PHP4?.
To read UTF-8 chars from a UTF-8 mysql db
Do this once after you open the connection:
mysql_query("SET NAMES 'utf8'");