e.g. I have this Product Id values 31,32 from database. I want to put them on array. So, I can use the values for foreach.
What I want to achieve: I want to get the stock of each product from database according to the given values (31,32).
What I tried:
$product_values = '31,32'; //this values can be different, sample values only
$arr_product_values = array();
$arr_product_values[] = $product_values;
foreach ($arr_product_values as $prod_id) {
echo $prod_id;
}
Expected output:
31 & 32
print_r($arr_product_values );and you'll find your array isn't what you expect