我有两个数组。
Array
(
[0] => Array
(
[id] => 12
[user_id] => 1
[date] => 2013-10-21 23:01:52
[type] => 1
[name] => Wypłata UNDICOM
[quantity] => 0
[value] => 1700
)
[1] => Array
(
[id] => 13
[user_id] => 1
[date] => 2013-10-21 23:01:52
[type] => 0
[name] => Rata (gwarancja MacBook Air)
[quantity] => 0
[value] => 90
)
[2] => Array
(
[id] => 16
[user_id] => 1
[date] => 2013-10-21 23:01:52
[type] => 0
[name] => TESCO (zakupy)
[quantity] => 0
[value] => 0
)
)
Array
(
[0] => Array
(
[id] => 3
[data_id] => 16
[name] => Coca-Cola
[quantity] => 2
[value] => 5
)
[1] => Array
(
[id] => 4
[data_id] => 16
[name] => Pizza
[quantity] => 1
[value] => 10
)
)
我想显示这两个数组,但第一个数组是一个类别,第二个有元素。id(第一个数组)和 data_id(第二个数组)之间的关系。在 MySQL 中是简单的 LEFT JOIN,但我不知道在 PHP 中是否有类似的功能。我只是尝试编写一些 if 等代码,但没有成功。我想要一个简单的解决方案,所以如果不可能,请告诉我。
干杯!