Q:

How to extract values from an associative array and use each value to display in different places

Basically I have this code right now:
<?php foreach($rows as $most_viewed) { ?>
  print_r($most_viewed);
<?php } ?>

the print_r function displays something like this:
Array
(
    [id] => 13
    [name] => item 1 
    [description_al] => bla bla
    [price] => 18.54
    [date] => 2015-07-19 23:13:48
    [category] => 1
    [brand] => 
    [image] => image-5e053b8f95f8819c37721826631c5c26136f20bfa07fd240aa9d4b3d6f939519-v.jpg
)
Array
(
    [id] => 19
    [name] => item 2
    [description_al] => bla bla bla
    [price] => 13.00
    [date] => 2010-07-20 10:45:16
    [category] => 3
    [brand] => 
    [image] => img-20160217-155609.jpg 
)

I want to be able to store from the first array into variables like the name of the product in one variable and the image of the product in another variable so that I can echo them out when ever I need them. I apologize if I have not made myself very clear but I dont know another way to explain my issue, thank you in advanced for your help. 

A:

Do you mean something like this...
$names = array();
$images = array();
foreach($rows as $row) {
  $names[] = $row['name'];
  $images[] = $row['image'];
}

