NOOB Question - Convert While loop to image

I am fairly new to PHP and simply want to create a star system for my site.

what i am doing is creating a variable with a number and want it to output a number of stars based on my variable. can this be achieved.

not sure if i am on right steps, but i currently have a while loop set up

<?php

$starter = 0;
$empty = 5;
// echo $empty;

while ($starter < $empty){

$starter = $starter + 1;
echo $starter;

}

?>

this gives me the following:
12345

instead of numbers i want it to loop the same image and output stars based on my $empty variable. is this possible? :}