What are the potential pitfalls when migrating a PHP 4.0 script to PHP 5.0?

One potential pitfall when migrating a PHP 4.0 script to PHP 5.0 is the deprecation of certain functions and features in PHP 5.0 that were present in PHP 4.0. This may lead to errors or unexpected behavior in the migrated script. To solve this issue, it is important to review the PHP migration guide for deprecated functions and features in PHP 5.0 and update the script accordingly.

// PHP 4.0 code using deprecated function
$result = mysql_query($query);

// PHP 5.0 code using mysqli function
$connection = mysqli_connect($host, $username, $password, $database);
$result = mysqli_query($connection, $query);