数组到字符串转换

In this code, I'm trying to display image from an array however, I'm getting array to string conversion error. From what I've googled, you'll have to use print_r in order to print string but I'm not exactly sure how I can do that:

<?php
$item_array = array(
  1 => array('product_img' => "images/013_8c9f517a.jpg",
            'product_name' => "black tshirt",
            'product_price' => "€99.00"),
  2 => array('product_img' => "images/014_28ded7a4.jpg",
            'product_name' => "white tshirt",
            'product_price' => "€99.00"));

echo "<img src=$item_array[1]['product_img']>";
?>

You just need to use proper string concatenation. Change this line:

echo "<img src=$item_array[1]['product_img']>";

To one of these options:

echo "<img src={$item_array[1]['product_img']}>";
echo "<img src=".$item_array[1]['product_img'].">";

Hope it helps.

Extracting a temporary variable could make things a whole lot easier:

$src = $item_array[1]['product_img'];
echo "<img src=${src}>";