What could be causing the "Parse error: parse error, unexpected T_VARIABLE" message in PHP when using the GD Library?

The "Parse error: parse error, unexpected T_VARIABLE" message in PHP when using the GD Library typically occurs when there is a syntax error in the code, such as missing semicolons, incorrect variable names, or misplaced parentheses. To solve this issue, carefully review the code for any syntax errors and correct them accordingly.

// Incorrect code causing parse error
$image = imagecreate(200, 200)
$color = imagecolorallocate($image, 255, 0, 0);
imagestring($image, 5, 50, 50, "Hello World", $color);
header('Content-Type: image/png');
imagepng($image);
imagedestroy($image);

// Corrected code without syntax errors
$image = imagecreate(200, 200);
$color = imagecolorallocate($image, 255, 0, 0);
imagestring($image, 5, 50, 50, "Hello World", $color);
header('Content-Type: image/png');
imagepng($image);
imagedestroy($image);