How can the provided code snippet for calculating a checksum in PHP be optimized or improved for better performance and accuracy?

The provided code snippet for calculating a checksum in PHP can be optimized by using the `hash` function with a stronger and faster hashing algorithm like SHA-256 instead of `md5`. This will improve both the performance and accuracy of the checksum calculation.

$data = "Hello, World!";
$checksum = hash('sha256', $data);
echo $checksum;