3v4l.org

run code in 500+ PHP versions simultaneously
<?php $context = [ 'total_pedidos' => '211,10', 'valor_credito' => '31,80', 'valor_debito' => '49,90', 'valor_dinheiro' => '129,40' ]; foreach ($context as $key => $valor) { $valor = str_replace('.', '', $valor); $valor = str_replace(',', '.', $valor); $context[$key] = number_format($valor, 2) * 100; } $total = $context['total_pedidos'] - ($context['valor_credito'] + $context['valor_debito'] + $context['valor_dinheiro']); $total = $total / 100; var_dump($total);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 18
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/n5ukT
function name:  (null)
number of ops:  33
compiled vars:  !0 = $context, !1 = $valor, !2 = $key, !3 = $total
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   10     1      > FE_RESET_R                                           $5      !0, ->18
          2    > > FE_FETCH_R                                           ~6      $5, !1, ->18
          3    >   ASSIGN                                                       !2, ~6
   11     4        FRAMELESS_ICALL_3                str_replace         ~8      '.', ''
          5        OP_DATA                                                      !1
          6        ASSIGN                                                       !1, ~8
   12     7        FRAMELESS_ICALL_3                str_replace         ~10     '%2C', '.'
          8        OP_DATA                                                      !1
          9        ASSIGN                                                       !1, ~10
   13    10        INIT_FCALL                                                   'number_format'
         11        SEND_VAR                                                     !1
         12        SEND_VAL                                                     2
         13        DO_ICALL                                             $13     
         14        MUL                                                  ~14     $13, 100
         15        ASSIGN_DIM                                                   !0, !2
         16        OP_DATA                                                      ~14
   10    17      > JMP                                                          ->2
         18    >   FE_FREE                                                      $5
   16    19        FETCH_DIM_R                                          ~15     !0, 'total_pedidos'
         20        FETCH_DIM_R                                          ~16     !0, 'valor_credito'
         21        FETCH_DIM_R                                          ~17     !0, 'valor_debito'
         22        ADD                                                  ~18     ~16, ~17
         23        FETCH_DIM_R                                          ~19     !0, 'valor_dinheiro'
         24        ADD                                                  ~20     ~18, ~19
         25        SUB                                                  ~21     ~15, ~20
         26        ASSIGN                                                       !3, ~21
   17    27        DIV                                                  ~23     !3, 100
         28        ASSIGN                                                       !3, ~23
   19    29        INIT_FCALL                                                   'var_dump'
         30        SEND_VAR                                                     !3
         31        DO_ICALL                                                     
         32      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.68 ms | 2281 KiB | 17 Q