<?php
$products = array();
$products[101] = array(
"name" => "Logo Shirt, Red",
"price" => 18,
"img" => "img/shirts/shirts-101.jpg"
);
echo $products;
?>
I am trying to run this php file and it keeps giving me this error - Notice: Array to string conversion in C:\xampp\htdocs\example\echo.php on line 8 Array.
All i want to do is echo out each and every element inside the array. I've also tried
<?php
$products = array();
$products[101] = array(
"name" => "Logo Shirt, Red",
"price" => 18,
"img" => "img/shirts/shirts-101.jpg"
);
foreach($products as $product){
echo $product;
}
?>
EDIT1: okay guys what if there are multiple similar arrays like $product[101] $product[102] $product[103] $product[104] . . . $product[n]
What then?