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']>";
?>