PHP for loop / imagestring Issue

I don’t understand why this code does not print A1 - A8 down the left side of my image. Can anyone help?

[php]<?php
$im = imagecreate(400,400);
header(“Content-type: image/jpg”);

    $white = imagecolorallocate($im, 255, 255, 255);
    $red = imagecolorallocate($im, 255, 0, 0);
    $black = imagecolorallocate($im, 0, 0, 0);
    $green = imagecolorallocate($im, 0, 255, 0);

    $text_color = imagecolorallocate($im, 0, 0, 0); //Black

    $col_a = 15;

    for($col_a_cnt=1; $col_a_cnt>8; $col_a_cnt++)
    {
            imagestring($im, 15, 15, $col_a, "A$col_a_cnt", $text_color);
            $col_a = $col_a + 50;
    }

    imagejpeg($im);
    imagedestroy($im);

?>
[/php]

Sorry, I forgot that the stop condition should be $col_a_cnt should be less than or equal to 8.

[php]$col_a = 15;

    for($col_a_cnt=1; $col_a_cnt<=8; $col_a_cnt++)
    {
            imagestring($im, 15, 15, $col_a, "A$col_a_cnt", $text_color);
            $col_a = $col_a + 50;
    }

[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service