How does the htmlspecialchars_decode function differ between PHP 4 and newer versions?

In PHP 4, the htmlspecialchars_decode function did not exist, so developers had to manually decode HTML entities using functions like html_entity_decode. In newer versions of PHP (5 and above), the htmlspecialchars_decode function was introduced to simplify the process of decoding HTML entities back to their original characters.

// Using htmlspecialchars_decode in PHP 5 and above
$encodedString = "<div>Hello, world!</div>";
$decodedString = htmlspecialchars_decode($encodedString);
echo $decodedString; // Output: <div>Hello, world!</div>