Could you provide sample array & output you're expecting. That way anyone can easily understand your requirement instead of going thru lines of code
Transform a PHP array on a HTML table
I have a PHP array with four levels of depth. I want to turn this table into an HTML table.
Here is my code : https://pastebin.com/NSgjzvR8
foreach($array[0] as $key1 => $value1) {...}: builds the header
foreach($array as $key1 => $value1) {...}: builds the body
I want to refactor this code and use a recursive function to do the same thing.
Here is my code to build the header of the html table : https://pastebin.com/ApXVx8Cr
recursiveHeader(array $array) {...}: builds the header
Here is my code to build the body of the body table : https://pastebin.com/wMCAqfyS
recursiveBody(array $array) {...}: builds the body
This code does not provide what I expect and I don't know how to resolve it. In fact, I just want to add recursive call in my code in place of multiple foreach
Please or to participate in this conversation.