I have this little bit of code inside one of my function:
$num1 = count($amounts);
for ($i = 2 ; $i < $num1 ; $i++) {
$test_value_1 = trim($amounts[$i-1]);
$test_value_2 = trim($amounts[$i-2]);
$test_value_3 = trim($amounts[$i]);
$plug_in = $test_value_1 + $test_value_2;
echo $i."( ".$test_value_1." + ".$test_value_2." = ".$plug_in." hopefully = ".$test_value_3." ) <br>";
if ($plug_in == $test_value_3) {
echo "Condition MET for : ".$i."<br>";
$amounts = array_remove_2($amounts, $i);
$i--;
}
}
and when I run it I get:
2( -5233184.81 + 72473.45 = -5160711.36 hopefully = 25899.78 )
3( 25899.78 + -5233184.81 = -5207285.03 hopefully = 1058869.58 )
4( 1058869.58 + 25899.78 = 1084769.36 hopefully = 8706.09 )
5( 8706.09 + 1058869.58 = 1067575.67 hopefully = 1067575.67 )
6( 1067575.67 + 8706.09 = 1076281.76 hopefully = 3141639.50 )
7( 3141639.50 + 1067575.67 = 4209215.17 hopefully = 750351.83 )
8( 750351.83 + 3141639.50 = 3891991.33 hopefully = 3891991.33 )
Condition MET for : 8
8( 750351.83 + 3141639.50 = 3891991.33 hopefully = 2275204.60 )
9( 2275204.60 + 750351.83 = 3025556.43 hopefully = 309120.76 )
10( 309120.76 + 2275204.60 = 2584325.36 hopefully = 3394734.92 )
11( 3394734.92 + 309120.76 = 3703855.68 hopefully = 404475.29 )
12( 404475.29 + 3394734.92 = 3799210.21 hopefully = 47587.13 )
13( 47587.13 + 404475.29 = 452062.42 hopefully = 6255878.12 )
14( 6255878.12 + 47587.13 = 6303465.25 hopefully = )
Now why isn't the condition met for number 5? This is driving me crazy!