What are the key differences between PHP 4 and PHP 5?

One key difference between PHP 4 and PHP 5 is the introduction of new features and improvements in PHP 5 such as improved object-oriented programming support, enhanced error handling, and better performance. Another significant change is the addition of new functions and extensions in PHP 5 that were not available in PHP 4. Additionally, PHP 5 introduced a more robust security model with features like filter extension for data filtering and validation.

// PHP 4 code
$sum = 10 + "10"; // $sum will be 20 in PHP 4

// PHP 5 code
$sum = 10 + "10"; // $sum will be 20 in PHP 5