I figured it out!!
$new_count can obviously be a number from an external source (eg. a database)
<?php
header('Content-Type: image/png');
$ima = imagecreate(200,30);
$new_count = "1231";
$split[0] = substr($new_count , 0,1);
$split[1] = substr($new_count , 1,1);
$split[2] = substr($new_count , 2,1);
$split[3] = substr($new_count , 3,1);
$split[4] = substr($new_count , 4,1);
$split[5] = substr($new_count , 5,1);
$split[6] = substr($new_count , 6,1);
$n=0;
$x=0;
$y=0;
$arraysize = count($split);
$ima = imagecreate(200,30);
while($n < $arraysize)
{
if($split[$n]!="")
{
$im = imagecreatefromgif ("http://scripts.petbo.com/images/1/black/$split[$n].gif");
if($split[$n]==0)
{
$wi = 8;
}
else
{
$wi = 12;
}
imagecopymerge($ima, $im, $x, "10", "0", "0",$wi, "15", "100");
$x=$x+ 15;
}
$n++;
}
ImagePNG($ima);
?>
The finished pic is available at http://scripts.petbo.com/maze.php