I am having an issue trying to work out how to use a function variable in a foreach loop so that I can do the following but its not working.
$var =
array(7) { [0]=> array(3) { ["listingId"]=> int(532712629) } [1]=> array(3) { ["listingId"]=> int(532712202) }
Works but not right:
foreach($var as $varr)
{
var_dump($varr['id']);
{
Goal - Having the array variable as the foreach value
foreach($var['id'] as $item)
{
if($item === $foo)
{
}
}
var_dump($varr['id']);
then we will get a better sense of what to do. – Stegrex Nov 18 '12 at 4:12$varr
is your array, then your foreach is backwards. syntax isforeach($array as $key => $value)
. – Marc B Nov 18 '12 at 4:13