平面设计程序不起作用

I recently read about graphic design extensions in PHP and I am trying to create a square with different colors. Example.

Here is my program:

<?php
$color = array(0 => array('35', '3B', '1A'),
               1 => array('7E', 'A6', '29'),
               2 => array('D9', 'C9', '9A'),
               3 => array('D9', '30', '30'),
               4 => array('73', '07', '10'),
               5 => array('D9', '62', 'C6')
               );
$image = imagecreate(200,200);
$maxsize = 200;
$currentcolor = 0;
$yellow = imagecolorallocate($image, 0xFF, 0xFF, 0x00);
for($i = 0; $i <= 200; $i += 10) {
    if($currentcolor == 6) {
        $currentcolor = 0;
    }
    $red = "0x".$color[$currentcolor][0];
    $green = "0x".$color[$currentcolor][1];
    $blue = "0x".$color[$currentcolor][2];
    $red = (int)$red;
    $green = (int)$green;
    $blue = (int)$blue;
    $rescolor = imagecolorallocate($image, $red, $green, $blue);
    imagefilledrectangle($image, $i, $i, $maxsize -= 10, $maxsize -= 10, $rescolor);
    $currentcolor++;
}
header("Content-Type: image/png");
imagepng($image);
?>

However, this code produces only a black square. How can I make the square multicolored?

These two arguments are almost CERTAINLY not what you want:

imagefilledrectangle($image, $i, $i, $maxsize -= 10, $maxsize -= 10, $rescolor);'
                                     ^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^

This code is actually functioning as:

$maxsize = $maxsize - 10;
$foo = $maxsize;
$maxsize = $maxsize - 10;
$bar = $maxsize;
imagefilledrectangle($image, $i, $i, $foo, $bar, $rescolor);