Define output as Image type
$n = 10;
Variable $n is the number of displayed digits
Using the above method, get the number of visitors and assign value to the variable $str1 (Cheng)
$str 1= $count;
$str 2 = "";
Number of digits if not enough $n, 0 in front
$len 1 = strlen ($str 1);
for ($i =1; $i <= $n; $i + +) {
$str 2 = "0". $str 2;
};
Get $n bit 0
$len 2 = strlen ($str 2);
Count the number of digits visited
$dif = $len 2-$len 1;
$rest = substr ($str 2, 0, $DIF);
$string = $rest. $str 1;
Number of digits if not enough $n, 0 in front
For ($i =0 $i <= $n-1; $i + +) {
$str [$i]=substr ($string, $i, 1);
};
Storing each digit in an array
$font = 4;
Define font Size
$im = Imagecreate ($n *11-1,16);
New Image
$black = Imagecolorallocate ($im, 0,0,0);
$white = Imagecolorallocate ($im, 255,255,255);
Define Color
Imagefill ($im, 0,0, $black);
Set the background of the counter to black
Imagestring ($im, $font, 1,0, $str [0], $white);
For ($i =1 $i <= $n-1; $i + +) {
Imageline ($im, $i *11-1,0, $i *11-1,16, $white);
Imagestring ($im, $font, $i *11+1,0, $str [$i], $white);
};
Writes each bit to the image and separates it with a vertical bar
Imagegif ($im);
Image output
Imagedestroy ($im);
Releasing the image