Very similar situation in this answer: Compare multidimensional array values by key in php Working when all child keys are identical, but problem when some child arrays are not identical or empty. So I decide to ask another question. Sample of the possible array:
$all_products = array(
'product_1' =>array(
'price' =>'$100',
'brand' =>'Apple'
),
'product_2' =>array(
'price' =>'$200',
'quantity' =>'2pcs.',
'available' =>'In Stock'
),
'product_3' =>array(
)
);
In this sample all child arrays are different.
|key name | product_1 | product_2 | product_3 |
-----------------------------------------------
| price | $100 | $200 | | row should be highlighted
-----------------------------------------------
| quantity| | 2pcs. | | row should be highlighted
-----------------------------------------------
|available| | In Stock | | row should be highlighted
-----------------------------------------------
| brand | Apple | | | row should be highlighted
-----------------------------------------------
I need compare this products and highlight rows where data in row is different. If all data in row are the same no highlighting. I have tried to use the way in mentioned answer Compare multidimensional array values by key in php Is working fine when all keys in a child rows are identical, but in this situation does not work... So no success. I got stuck at all... If anybody can help I'll be very thankful.
highlight rows where data in row is different=> different when you compare with what ? If you have row1 = row2 and row 3 = row 4, but row1 != row3, what will you highlight ?