Welcome Guest, Not a member yet? Register   Sign In
looping through entire multidimensional array passed to view
#3

[eluser]Kamarg[/eluser]
Code:
function recurse($item, $level = 1)
{
  foreach($item as $k => $v)
  {
    if(is_array($v) || is_object($v))
      recurse($v, $level + 1);
    else
      echo "<td>$v</td>";
  }
}

recurse($your_data_array);

That should do the trick.

Edit: Sorry. Took me a min to realize you probably want to do more than output them all as one row. My brain has already switched off for the day it seems.


Messages In This Thread
looping through entire multidimensional array passed to view - by El Forum - 01-30-2012, 02:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB