What best practices should be followed when updating PHP scripts to be PHP 7 compatible?

When updating PHP scripts to be PHP 7 compatible, it is important to address deprecated features, syntax changes, and potential compatibility issues. This may involve updating functions, methods, and libraries to their PHP 7 equivalents, as well as ensuring that error handling and type declarations are properly implemented.

// Before PHP 7
mysql_connect('localhost', 'username', 'password');

// After PHP 7
mysqli_connect('localhost', 'username', 'password');