Consider this array
    array(6) {
  ["id"]=>
  int(346058)
  ["amount"]=>
  string(5) "60.00"
  ["id_shop_where_transaction_is_done"]=>
  int(300)
  ["id_shop_where_money_come_from"]=>
  NULL
  ["negative_sum"]=>
  float(-60)
  ["negative"]=>
  array(11) {
    [0]=>
    array(5) {
      ["id"]=>
      int(346060)
      ["amount"]=>
      string(5) "-2.20"
      ["id_shop_where_transaction_is_done"]=>
      int(300)
      ["id_shop_where_money_come_from"]=>
      NULL
      ["id_referring_transaction"]=>
      int(346058)
    }
    [1]=>
    array(5) {
      ["id"]=>
      int(348152)
      ["amount"]=>
      string(5) "-7.50"
      ["id_shop_where_transaction_is_done"]=>
      int(300)
      ["id_shop_where_money_come_from"]=>
      NULL
      ["id_referring_transaction"]=>
      int(346058)
    }
    [2]=>
    array(5) {
      ["id"]=>
      int(350163)
      ["amount"]=>
      string(5) "-7.70"
      ["id_shop_where_transaction_is_done"]=>
      int(300)
      ["id_shop_where_money_come_from"]=>
      NULL
      ["id_referring_transaction"]=>
      int(346058)
    }
    [3]=>
    array(5) {
      ["id"]=>
      int(351996)
      ["amount"]=>
      string(5) "-5.20"
      ["id_shop_where_transaction_is_done"]=>
      int(300)
      ["id_shop_where_money_come_from"]=>
      NULL
      ["id_referring_transaction"]=>
      int(346058)
    }
    [4]=>
    array(5) {
      ["id"]=>
      int(353919)
      ["amount"]=>
      string(5) "-5.00"
      ["id_shop_where_transaction_is_done"]=>
      int(300)
      ["id_shop_where_money_come_from"]=>
      NULL
      ["id_referring_transaction"]=>
      int(346058)
    }
    [5]=>
    array(5) {
      ["id"]=>
      int(354768)
      ["amount"]=>
      string(5) "-2.50"
      ["id_shop_where_transaction_is_done"]=>
      int(300)
      ["id_shop_where_money_come_from"]=>
      NULL
      ["id_referring_transaction"]=>
      int(346058)
    }
    [6]=>
    array(5) {
      ["id"]=>
      int(356650)
      ["amount"]=>
      string(5) "-5.00"
      ["id_shop_where_transaction_is_done"]=>
      int(300)
      ["id_shop_where_money_come_from"]=>
      NULL
      ["id_referring_transaction"]=>
      int(346058)
    }
    [7]=>
    array(5) {
      ["id"]=>
      int(361683)
      ["amount"]=>
      string(5) "-5.00"
      ["id_shop_where_transaction_is_done"]=>
      int(300)
      ["id_shop_where_money_come_from"]=>
      NULL
      ["id_referring_transaction"]=>
      int(346058)
    }
    [8]=>
    array(5) {
      ["id"]=>
      int(361836)
      ["amount"]=>
      string(5) "-7.50"
      ["id_shop_where_transaction_is_done"]=>
      int(300)
      ["id_shop_where_money_come_from"]=>
      NULL
      ["id_referring_transaction"]=>
      int(346058)
    }
    [9]=>
    array(5) {
      ["id"]=>
      int(364145)
      ["amount"]=>
      string(5) "-7.90"
      ["id_shop_where_transaction_is_done"]=>
      int(300)
      ["id_shop_where_money_come_from"]=>
      NULL
      ["id_referring_transaction"]=>
      int(346058)
    }
    [10]=>
    array(5) {
      ["id"]=>
      int(364426)
      ["amount"]=>
      string(5) "-4.50"
      ["id_shop_where_transaction_is_done"]=>
      int(300)
      ["id_shop_where_money_come_from"]=>
      NULL
      ["id_referring_transaction"]=>
      int(346058)
    }
  }
}
A bit of explain:
$array[0]['negative_sum']
is the sum of the $array[0]['negative'][$i]['amount']
(If you do the sum, total is -60.)
Now, I need to check if $array[0]['amount'] is > of the negative_sum and so some stuff.
$positive_amount = $transaction[$i]['amount'];
$negative_amount = $transaction[$i]['negative_sum'];
if ($positive_amount>abs($negative_amount)) {
    $difference = -$positive_amount-$negative_amount;
    var_dump($difference);
    $data['difference'] = $difference;
}
First of all, the if code in specific case would not be executed, because 60 is not bigger than abs(-60). But it is executed.
Second one, var_dump($difference) output is
float(-7,105427357601E-15)
cannot understand why. Thank you.
Per @OptimusCrime answer. I did modify a bit the code.
$positive_amount = $transaction[$i]['amount'];
$negative_amount = $transaction[$i]['negative_sum'];
var_dump(number_format($positive_amount, 90));
var_dump(number_format($negative_amount, 90));
if ($positive_amount>abs($negative_amount)) {
    $difference = -$positive_amount-$negative_amount;
    var_dump($difference);
    $data['difference'] = $difference;
}
That var_dump outputs both:
string(93) "60.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" 
string(94) "-60.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
 
    