What are the best practices for upgrading PHP code from PHP4 to PHP5?

When upgrading PHP code from PHP4 to PHP5, it is important to address deprecated features and syntax changes in the newer version. This may include updating functions, classes, and variable declarations to adhere to PHP5 standards. Additionally, it is recommended to test the code thoroughly after making changes to ensure compatibility and functionality.

// Example of upgrading PHP4 code to PHP5
// PHP4 code
$var = "Hello World";
echo $var;

// PHP5 code
$var = "Hello World";
echo $var;