I am using simple html dom to get the contents of a table:
foreach($html->find('#maintable .table tr td') as $a) {
$array[] = $a->plaintext;
}
print_r($array);
The array returned looks like this:
Array (
[0] => 1
[1] => 0xd35a2d8c651f3eba4f0a044db961b5b0ccf68a2d
[2] => 309953166.54621424
[3] => 30.9953%
[4] => 2
[5] => 0xe17c20292b2f1b0ff887dc32a73c259fae25f03b
[6] => 200000001
[7] => 20.0000%
[8] => 3
[9] => 0x0000000000000000000000000000000000000000
[10] => 129336426
[11] => 12.9336%
)
I would like to create a new multidimensional array from the array above that skips one row every three rows starting with the first row like this:
New Array (
[1]
['address'] => 0xd35a2d8c651f3eba4f0a044db961b5b0ccf68a2d
['amount'] => 309953166.54621424
['percent'] => 30.9953%
[2]
['address'] => 0xe17c20292b2f1b0ff887dc32a73c259fae25f03b
['amount'] => 200000001
['percent'] => 20.0000%
[3]
['address'] => 0x0000000000000000000000000000000000000000
['amount'] => 129336426
['percent'] => 12.9336%
)
In the new array, "address" represents [1] [5] and [9] from the original array. "amount" represents [2] [6] and [10], and "percent" represents [3] [7] and [11].
How can I accomplish this? Thank you