I have an array like this which I fetch using file_get_content and here is other side url (http://sample.com/change.php)code from where I fetch array.
$a=array();
$a=Db::getInstance()->ExecuteS("SELECT *
FROM tablename
LIMIT 0 , 2
;");
$a=(array)$a;
print_r($a);
Then i use
$result = file_get_contents('http://sample.com/change.php');
That is the output of $result:
Array
(
[0] => Array
(
[id_stock_available] => 1
[id_product] => 1
[id_product_attribute] => 0
[id_shop] => 1
[id_shop_group] => 0
[quantity] => 3
[depends_on_stock] => 0
[out_of_stock] => 2
)
[1] => Array
(
[id_stock_available] => 2
[id_product] => 2
[id_product_attribute] => 0
[id_shop] => 1
[id_shop_group] => 0
[quantity] => 1
[depends_on_stock] => 0
[out_of_stock] => 2
)
)
When I apply foreach for $result:
foreach ($result as $value) {
var_dump($value);
//var_dump($value['installed'];
}
it shows me Invalid argument supplied for foreach()
.