Firstly, your data is erroneous. The function takes an array of arrays as an argument.
Pay attention to the line
foreach (array_keys($data[0]) as $key) {
... this function call is also incorrect; it must NOT accept the first element, it must accept the entire array, since it uses keys from the array.
Try it: first change the call to array_keys to use the whole array, i.e.
foreach(array_keys($data AS $key)
then change your input and function call:
$data= array( 'data1' => array('one','two','three'), 'data2' => array('four','five','six'), 'data3' => array('seven','eight','nine') ); echo render_table($data);
source share