3v4l.org

run code in 300+ 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 = 24
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 24
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/n5ukT
function name:  (null)
number of ops:  39
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, ->24
          2    > > FE_FETCH_R                                       ~6      $5, !1, ->24
          3    >   ASSIGN                                                   !2, ~6
   11     4        INIT_FCALL                                               'str_replace'
          5        SEND_VAL                                                 '.'
          6        SEND_VAL                                                 ''
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $8      
          9        ASSIGN                                                   !1, $8
   12    10        INIT_FCALL                                               'str_replace'
         11        SEND_VAL                                                 '%2C'
         12        SEND_VAL                                                 '.'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $10     
         15        ASSIGN                                                   !1, $10
   13    16        INIT_FCALL                                               'number_format'
         17        SEND_VAR                                                 !1
         18        SEND_VAL                                                 2
         19        DO_ICALL                                         $13     
         20        MUL                                              ~14     $13, 100
         21        ASSIGN_DIM                                               !0, !2
         22        OP_DATA                                                  ~14
   10    23      > JMP                                                      ->2
         24    >   FE_FREE                                                  $5
   16    25        FETCH_DIM_R                                      ~15     !0, 'total_pedidos'
         26        FETCH_DIM_R                                      ~16     !0, 'valor_credito'
         27        FETCH_DIM_R                                      ~17     !0, 'valor_debito'
         28        ADD                                              ~18     ~16, ~17
         29        FETCH_DIM_R                                      ~19     !0, 'valor_dinheiro'
         30        ADD                                              ~20     ~18, ~19
         31        SUB                                              ~21     ~15, ~20
         32        ASSIGN                                                   !3, ~21
   17    33        DIV                                              ~23     !3, 100
         34        ASSIGN                                                   !3, ~23
   19    35        INIT_FCALL                                               'var_dump'
         36        SEND_VAR                                                 !3
         37        DO_ICALL                                                 
         38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.26 ms | 1396 KiB | 19 Q