tableToArray

tableToArray ( string htmlOfTheTable ) : array

Transform an HTML table into an associative array of data. Column title are converted in text, and values are html content of td tags.

Example


Col ACol B
12
34
is transformed into
[["Col A":"1","Col B":"2"],["Col A":"3","Col B":"4"]]
html = '
Col ACol B
12
34
'
console(tableToArray(html)) //-> [{Col A=1, Col B=2}, {Col A=3, Col B=4}]

Parameters

htmlOfTheTable

HTML code of the table element to transform into an associative array. Caution ! The <table> tag must be in the code.