Hello, I was trying to extract the values of the associative array, but I couldn't figure out how to get them out. When I run this code, I get an warning saying: Warning: Invalid argument supplied for foreach()
<?php
// Append associative array elements
$order = array();
function array_push_associative(&$arr)
{
$args = func_get_args();
foreach ($args as $arg)
{
if(is_array($arg))
{
foreach ($arg as $key => $value)
{
$arr[$key] = $value;
$ret++;
}
}
else
{
$arr[$arg] = "";
}
}
return $ret;
}
$i = 0;
while($i < 5)
{
$myArr = array($i => "hello");
$order .= array_push_associative($myArr);
$i++;
}
// This causes an error
foreach($order as $key => $value)
{
echo "Our key $key is $value\n";
}
print_r($order);
?>