//declare array variable
$data['direct_sponsor_bonus_vals']=array('package_size'=>'');
// insert element to array
for ($x = 0; $x <= 10; $x++) {
$data['direct_sponsor_bonus_vals']=array('package_size'=>$x);
}
//show output
foreach($direct_sponsor_bonus_vals As $key => $value )
{
echo $value . ",";
}
Output :
10,
How to make Output become like below :
0,2,3,4,5,6,7,8,9,10
I have tried replace
$data['direct_sponsor_bonus_vals']=array('package_size'=>$x);
by
$data['direct_sponsor_bonus_vals']['package_size'][] = $x;
but still not working.
Update : I think the bug is at foreach loop. Need 2 of foreach loop. I tried:
foreach ($direct_sponsor_bonus_vals As $key => $value )
{
foreach ($value As $key_inner => $value_inner)
{
echo $value_inner; // whatever
}
}
Still has bug error : Invalid argument supplied for foreach()