Problem with script counter.php

yes i read that somewhere so i removed the echo,
unfortuatly its still not working i can’t get it to show any images, just says “hit counter” on my webpage. does anyone have this working on a live webpage.
below is the code i am using:-
`

<?php session_start(); $debug = true; // Change this to false when you want to stop the extra echos $counter_name = "counter.txt"; // Check if a text file exists. If not create one and initialize it to zero. if (!file_exists($counter_name)) { $f = fopen($counter_name, "w"); fwrite($f,"0"); fclose($f); } // Read the current value of our counter file $f = fopen($counter_name,"r"); $counterVal = fread($f, filesize($counter_name)); fclose($f); // Has visitor been counted in this session? // If not, increase counter value by one if(!isset($_SESSION['hasVisited'])){ $_SESSION['hasVisited']="yes"; $counterVal++; $f = fopen($counter_name, "w"); fwrite($f, $counterVal); fclose($f); } $counterVal = str_pad($counterVal, 5, "0", STR_PAD_LEFT); $chars = preg_split('//', $counterVal); $im = imagecreatefrompng("canvas2.png"); $src1 = imagecreatefrompng("$chars[0].png"); $src2 = imagecreatefrompng("$chars[1].png"); $src3 = imagecreatefrompng("$chars[2].png"); $src4 = imagecreatefrompng("$chars[3].png"); $src5 = imagecreatefrompng("$chars[4].png"); imagecopymerge($im, $src1, 0, 0, 0, 0, 56, 75, 100); imagecopymerge($im, $src2, 60, 0, 0, 0, 56, 75, 100); imagecopymerge($im, $src3, 120, 0, 0, 0, 56, 75, 100); imagecopymerge($im, $src4, 180, 0, 0, 0, 56, 75, 100); imagecopymerge($im, $src5, 240, 0, 0, 0, 56, 75, 100); // Output and free from memory header('Content-Type: image/png'); imagepng($im); imagedestroy($im); ?>

`
still not understanding if my counter went to 88 how does the script know to use the image file 8.png if its not in the code??