Need to change the output of the array format generated by SimpleHtmlDom. my PHP code is. The results of the SimpleHtmlDom that I'm using is returning hospital names as the key not the value?:
<?php
require('simple_html_dom.php');
$table = array();
$html = file_get_html('https://www.miemssalert.com/chats/Default.aspx?hdRegion=3');
foreach($html->find('table#tblHospitals tr td.Chats') as $e)
{
//echo $e->plaintext . $e->getAttribute('style') . '<hr>';
$nametime = $e->plaintext;
$color = $e->getAttribute('style');
$table[$nametime][$color] = true;
}
echo json_encode($table);
echo '<pre>';
var_dump($table);
echo '</pre>';
?>
current Array results:
array(37) {
["Anne Arundel Medical Center"]=>
array(1) {
[0]=>
bool(true)
}
[""]=>
array(1) {
[0]=>
bool(true)
}
["Baltimore Washington Medical Center"]=>
array(1) {
[0]=>
bool(true)
}
["04:31"]=>
array(1) {
["background-color:#ffff00;color:#000000;"]=>
bool(true)
}
["Bon Secours Hospital"]=>
array(1) {
[0]=>
bool(true)
}
...
Looking for results to be nested array by Name=>Time=>Color
array(37) {
array(1) {["Name"]=>["Anne Arundel Medical Center"]=>
array(2) {
[time]=>[""],[color]=>[""]
}
}
array(1) {["Name"]=>["Baltimore Washington Medical Center"]=>
array(2) {
[time]=>["04:31"],[color]=>["background-color:#ffff00;color:#000000;"]
}
}
array(1) {["Name"]=>["Bon Secours Hospital"]=>
array(2) {
[time]=>[""],[color]=>[""]
}
}
...