- array_walk: documentation ( source)
- printf: documentation ( source)
<?php
$table_array = array();
$result = array('hi', 'hello', 'there');
array_walk($result, function($row) {
printf('%s ', $row);
$index = $row;
$table_array[$index] = array();
}, $table_array);