Как из многомерного массива PHP вывести нужный элемент массива по id

Требуется по id вывести соответственно содержимое ["thumb"]


[0]=>
array(9) {
  ["product_id"]=>
    string(2) "36"
  ["thumb"]=>
    string(65) "http://t/image/cache/catalog/armature-500x500.jpg"
  ["name"]=>
    string(42) "Арматура А1 ф10 ст3сп 11,7м"
  ["description"]=>
    string(102) "any text"
  ["price"]=>
    string(6) "1.6р."
  ["special"]=>
    bool(false)
  ["tax"]=>
    bool(false)
  ["rating"]=>
    float(0)
  ["href"]=>
    string(34) "http://t.loc/ipod-nano"
}
[1]=>
 array(9) {
  ["product_id"]=>
    string(2) "41"
  ["thumb"]=>
    string(65) "http://t.loc/image/cache/catalog/armatura-500x500.png"
  ["name"]=>
    string(38) "Арматура А1 ф18 А240 11,7м"
  ["description"]=>
    string(183) "Арматура стальная.
  ["price"]=>
    string(9) "1566.0р."
  ["special"]=>
    bool(false)
  ["tax"]=>
    bool(false)
  ["rating"]=>
    float(0)
  ["href"]=>
    string(29) "http://t.loc/imac"
}

Ответы (1 шт):

Автор решения: Denis640Kb
<?php
$Arr = array(array(
    "product_id" => "36",
    "thumb" => "http://t/image/cache/catalog/armature-500x500.jpg",
    "name" => "Арматура А1 ф10 ст3сп 11,7м",
    "description" => "any text",
    "price" => "1.6р.",
    "special" => false,
    "tax" => false,
    "rating" => 0,
    "href" => "http://t.loc/ipod-nano"
),
array(
    "product_id" => "41",
    "thumb" => "http://t.loc/image/cache/catalog/armatura-500x500.png",
    "name" => "Арматура А1 ф18 А240 11,7м",
    "description" => "Арматура стальная.",
    "price" => "1566.0р.",
    "special" => false,
    "tax" => false,
    "rating" => 0,
    "href" => "http://t.loc/imac"
)
);

$id = "41"; // Указываем id по которому искать.

foreach ($Arr as $item) {
    if($item['product_id'] == $id){
        echo $item['thumb']; // Можно либо просто выводить, либо добавлять в массив, либо в сразу оформив в <img src="$item['thumb']"/>
    }
}
→ Ссылка