What potential pitfalls can arise when migrating PHP scripts from older versions (e.g., PHP3 or PHP4) to PHP5?

One potential pitfall when migrating PHP scripts from older versions to PHP5 is the use of deprecated functions or features that are no longer supported in PHP5. To solve this issue, you will need to update your code to use modern equivalents or alternative methods provided in PHP5.

// Before PHP5
mysql_connect("localhost", "username", "password");

// After PHP5
$mysqli = new mysqli("localhost", "username", "password");
if ($mysqli->connect_error) {
    die("Connection failed: " . $mysqli->connect_error);
}