In the context of PHP development, what are some common pitfalls when adapting or modifying older scripts for current versions of PHP?

When adapting or modifying older scripts for current versions of PHP, some common pitfalls include deprecated functions, changes in syntax, and compatibility issues with newer PHP versions. To solve these issues, it is important to update deprecated functions with their modern equivalents, adjust syntax to meet current standards, and ensure compatibility by checking for any changes in behavior between PHP versions.

// Before modification
$oldVariable = mysql_query("SELECT * FROM table");

// After modification
$newVariable = mysqli_query($connection, "SELECT * FROM table");