I have the following situation and cannot find an easy way to do it.
I have 2 arrays:
1)
Array (
[0] => Array
(
[FirstName] => Tom
[LastName] => Siemens
[Id] => 10300
)
[1] => Array
(
[FirstName] => Sam
[LastName] => Tailor
[Id] => 10301
)
2)
Array
(
[0] => Array
(
[Type] => Invoice
[Number] => 6344394
[Project] => Array
(
[Name] => Test Project 1
[ResponsibleUserId] => 10300
[Id] => 498
[ResponsibleUser] =>
)
)
[1] => Array (
[Type] => Invoice
[Number] => 6345555
[Project] => Array
(
[Name] => Test Project 2
[ResponsibleUserId] => 10301
[Id] => 499
[ResponsibleUser] =>
)
)
What could be the best approach to get the "FirstName LastName" from the first array depends on the ID which must equal the Project Id from the second array and to put these values inside the second array -> Project -> ResponsibleUser?
The result I'm looking for is the following:
Final Array)
Array (
[0] => Array
(
[Type] => Invoice
[Number] => 6344394
[Project] => Array
(
[Name] => Test Project 1
[ResponsibleUserId] => 10300
[Id] => 498
[ResponsibleUser] => Tom Siemens
)
)
[1] => Array (
[Type] => Invoice
[Number] => 6345555
[Project] => Array
(
[Name] => Test Project 2
[ResponsibleUserId] => 10301
[Id] => 499
[ResponsibleUser] => Sam Tailor
)
)