Example. Display data from PHP Array, or MySQL database, in HTML table, using for(), or foreach() instructions. If the Array is a numeric array (with keys /index consecutive numbers), you can use the for() instruction to traverse the array. end. Because affords the function range(). The str_pad() can be useful for concatenating a string to the beginning or end of the incrementing number to simulate a different precision. Specifies the number of elements to insert: value: Required. Specifies the value to use for filling the array: Technical Details. Version: (PHP 4 and above) Syntax: array_fill(starting_index, num_of_elements, array_values ) Parameter: But it is easier. Topic: PHP / MySQL Prev|Next Answer: Use the PHP foreach loop. Parameters. PHP: Fill an array with values. You can simply use the PHP foreach loop to create or populate HTML