Jump to content

using array_sum() in a variable?


Lucky2710

Recommended Posts

First off is this even possible? If so please help!!! :confused:

 

I've got 2 arrays i'm trying to compare and i've gone at this at every angle i can think of and this seems to be the most promising if i can just get this 1 thing to work.

 

Heres my code so far.

for($i=0; $i< count($each); $i++) {

$final = racePicks($each[0]); //This is the Admin Array
$picks = racePicks($each[$i]);

$final_sum = array_sum($final);
$picks_sum = array_sum($picks);

if ($final_sum == $picks_sum)
{
echo 'they got em right!';
}
else
{
   echo 'they got em wrong '; 
}
}

 

and so the problem seems to be that

$final_sum = array_sum($final);

&

$picks_sum = array_sum($picks); aren't working.

 

If anybody knows if how to make this work please let me know.

And if you are 100% sure it aint gonna work tell me that too so i don't waste any more time.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/208481-using-array_sum-in-a-variable/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.