I have two two-dimensional arrays that need to be merged into a single multi-dimensional array that has all values based on matching the key in one to one of the values in the other. The example below has been simplified as the first array typically has many more entries so I showed only the first and the number of key/value pairs in the first array may be greater or fewer and even in a different order. I see another similar question asked here but it relates to known keys and values but on mine they are not known from usage to usage so it must be able to find the match itself.
No clue where to start so I hope someone here can help!
// First array to match PhotoName key . . .
Array
(
[0] => Array
(
[ID] => 42
[PhotoCaption] => Some caption for Image1
[PhotoName] => Image1.jpg
[AlbumName] => Name Of This Album
)
)
// . . . to FieldName value
Array
(
[0] => Array
(
[FieldType] => 5
[FieldTitle] => Caption
[FieldName] => PhotoCaption
[LookupQuery] =>
)
[1] => Array
(
[FieldType] => 1
[FieldTitle] => Photo Name
[FieldName] => PhotoName
[LookupQuery] =>
)
[2] => Array
(
[FieldType] => 1
[FieldTitle] => Album Name
[FieldName] => AlbumName
[LookupQuery] =>
)
[3] => Array
(
[FieldType] => 0
[FieldTitle] =>
[FieldName] => ID
[LookupQuery] =>
)
)
// Rough sample of merged array that it should build (illustration only, syntax probably not correct)
Array
(
[0] => Array
(
[ID] => 42
[0] => Array
(
[FieldType] => 0
[FieldTitle] =>
[FieldName] => ID
[LookupQuery] =>
)
[PhotoCaption] => Some caption for Image1
[1] => Array
(
[FieldType] => 5
[FieldTitle] => Caption
[FieldName] => PhotoCaption
[LookupQuery] =>
)
[PhotoName] => Image1.jpg
[2] => Array
(
[FieldType] => 1
[FieldTitle] => Photo Name
[FieldName] => PhotoName
[LookupQuery] =>
)
[AlbumName] => Name Of This Album
[3] => Array
(
[FieldType] => 1
[FieldTitle] => Album Name
[FieldName] => AlbumName
[LookupQuery] =>
)
)
)