It would be better if you could redesign your array so that it looks more like this;
Array
(
[a-04] => Array
(
[Stock book code] => a-04
[Date] => 1962
[Work Title] => River Barge
[height] => 0
[width] => 0
[materials] => Oil on Board
[Ownership] => Sold
)
[a-08] => Array
(
[Stock book code] => a-08
[Date] => 1962
[Work Title] => Thames Bridge Fantasy
[height] => 48
[width] => 36
[materials] => Oil on Board
[Ownership] => Available
)
)
Then you could just call the data like $additionalData[$image]['Work Title'], assuming your additional data array is stored in $additionalData and your $image contains the stock number of the item. What you're essentially doing here is creating an array of models, where each row of the array contains all the information about one instance of the data.
you can make your array look like this by adding a function so
function createModels($data)
{
$newRow = array();
if (is_array($data)){
foreach($data as $rowIndex => $row){
if(is_array($row)){
$newRowIndex = $row['Stock book code'];
}
$newData[$newRowIndex] = array_merge($newRow, $row);
}
}
return $newData;
}
and calling it from your existing snippet.