How to modify the PHP counter from picture display to text and number display?

the code is as follows:

/********************************************************************/
/* :)  :)
/*:
/*<script src="http:///count/count.php?id=1"></script>
/*id=1:id=myhome
/*id
/*:)
/*
/**********************************************************************/

    if(!isset($id))                //id
    {
        $id=1;
    }

    $file="count/".$id.".php";    //

    if(!file_exists($file))        //
    {
        chmod("count/",0777);    //
        fopen($file,"w+");
    }

    if(!is_writeable($file))    //
    {
        chmod($file,0777);        //
    }

    $fo=fopen($file,"r");        //
    $fg=fgets($fo,10000);        //
    
    if($fg=="")$fg=0;

    $fgPP;

    $fo2=fopen($file,"w+");        //
    fputs($fo2,$fg);

    $fg=sprintf("%06s",$fg);    // %06s  %08s 8
    $mc=chunk_split($fg,1,"|");        //|
    $arr=explode("|",$mc);        //|
    echo "muhang="";\n";

    for($i=0;$i<count($arr);$iPP)
    {
        if($arr[$i]!="")
        {
            echo "muhang+="<img src=countimg/".$arr[$i].".gif>";\n";
        }
    }

    echo "document.write(muhang);";    //

?>

the counting result is shown in the following figure:

the effect that needs to be achieved: first, do not want to be pictorial, want to become textual, and second, do not add 000 in front of a number, such as 266, do not display as 000266 thank you.

Php
Mar.22,2022

1. It would be nice to have direct digital output
2. Remove sprintf

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eac8d6-47ec8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eac8d6-47ec8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?