Page 1 of 1

Extracting variable values from nested arrays

Posted: Mon Oct 25, 2004 5:56 am
by tasha
I need to extract the values from a nested array so that I can send an email each staff member that has a -ve number of points, currently only the array index number is send for $staffFK and nothing is sent for $total, I have tried several things none of which work, can anyone help?

//declare array existing negative points
$existingNegativePoints = array();
// check if they're new
foreach ($negList AS $staffFK => $total){
if ($existingNegativePoints[$staffFK] == ""){
array_push($existingNegativePoints, array($staffFK, $total));
mail($supportMail, "DTH - just found member with NEGATIVE POINTS!!", "StaffFK = " .$staffFK.", Points = ".$total);

}
}

Thank you
Tasha

Posted: Mon Oct 25, 2004 6:05 am
by ibizconsultants
You could try using

if (isset($existingNegativePoints[$staffFK]) == false){

Posted: Mon Oct 25, 2004 6:41 am
by tasha
I have realised that $total is an array itself, so the elements I need to access are in fact $total[0] and $total[1].

Thanks for help

Natasha