Array (
[Team1] => Array (
[win] => 1
[draw] => 0
[lost] => 0
)
[Team2] => Array (
[win] => 1
[draw] => 1
[lost] => 1
)
[Team3] => Array (
[win] => 1
[draw] => 0
[lost] => 1
)
[AnotherTeam] => Array (
[win] => 0
[draw] => 0
[lost] => 1
)
[LastTeam] => Array (
[win] => 0
[draw] => 1
[lost] => 0
)
)
Above is an example of a generated array. Imagine there are some football clubs with their win draw and lost number of games.
I would like to print this array as rows and columns of a table like following;
Team | Win | Draw | Lost
Team 1 1 0 0
Team 2 1 1 1
I had an advice to use extract method. But didn't figure out well. Hope anyone can give me a clue.
Thanks,
array_keys($yourArray[0])should give you the array of header. Just iterate over this array to print the header. Finally iterate of the initial array$yourArrayto print the content.