使用php创建一个饼图

I saw a tutorial online where they claim that the code below makes a pie chart. Yet when I run this exact code i have the error Fatal error: Call to undefined function imagecolorsallocate() in /**/**/*/piechart.php on line 7 (I've used asterix to cover my folders names). Any suggestions? Or is there any other way to create one preferably without using third party material.

<?php

//create image
$image = imagecreatetruecolor(100,100);

//allocate some colour
$white = imagecolorsallocate($image, 0xFF , 0xFF, 0xFF);
$gray = imagecolorsallocate($image, 0xC0 , 0xC0, 0xC0);
$darkgray = imagecolorsallocate($image, 0x90 , 0x90, 0x90);
$navy = imagecolorsallocate($image, 0x00 , 0x00, 0x80);
$darknavy = imagecolorsallocate($image, 0x00 , 0x00, 0x05);
$red = imagecolorsallocate($image, 0xFF , 0x00, 0x00);
$darkred = imagecolorsallocate($image, 0x90, 0x00, 0x00);

//make the 3d effect
for($i = 60; $i >50; $i--){
imagefilledarc($image, 50, $i, 100, 50, 0, 45, $darknavy, IMG_ARC_PIE);
imagefilledarc($image, 50, $i, 100, 50, 45, 75, $darkgray, IMG_ARC_PIE);
imagefilledarc($image, 50, $i, 100, 50, 75, 360, $darkred, IMG_ARC_PIE);
}
imagefilledarc($image ,50 ,50 , 100, 50, 0, 45, $navy, IMG_ARC_PIE);
imagefilledarc($image ,50 ,50 , 100, 50, 45, 75, $gray, IMG_ARC_PIE);
imagefilledarc($image ,50 ,50 , 100, 50, 75, 360, $red, IMG_ARC_PIE);

//flush image
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
?>

Thanks

It should of been imagecolourallocate not imagecoloursallocate. This would not of been spotted if it were not for Class