Hello, I don't know if this is what you want. And I'm sure the code could be more efficient, but is this what you want to do?
$list = array(6,5,4,3); //Create an array with the numbers
$out_arr = array(); //Create an array to hold the answers
foreach( $list as $num ){ //Cycle through first array
$tmp = ""; //Create temp string to hold number
for ($i = $num; $i > 0; $i --){ //Loop to add $num as a string to the temp string we just made, $num times
$tmp .= "$num";
}
$newnum = (int) $tmp; //Create temp number to add to array
array_push($out_arr, $newnum); //Add answer to array
}
print_r($out_arr); //Echo array on screen (for testing)
I'm sorry I can't help any more, I don't really understand the question.
Good Luck!
EDIT:
I just read you question again, and did you want that as a function as opposed to a loop that runs through an array?
Maybe like this?
function counter_thing($num){ //$num is the input number
$tmp = ""; //Create temp string to hold answer
for ($i = $num; $i > 0; $i --){ //Add $num to temp string $num times
$tmp .= "$num";
}
return = (int) $tmp; //Convert temp string into an int (number) and return it.
}
Again, I still don't completely understand what you want, nor do I understand what the function is meant to be for. (That's why I called it "counter_thing")
Hope this helps