3v4l.org

run code in 300+ PHP versions simultaneously
<?php function calculate($input) { $count = 0; foreach ($input as $value) if (!empty($value)) $count++; return $count < 3 ? $count * 8.5 : 20; } // VOORBEELD 1: $_SESSION = array(); // simuleren van een SESSION array $_SESSION['input']['1'] = 'JA'; $_SESSION['input']['2'] = ''; $_SESSION['input']['3'] = 'JA'; $_SESSION['input']['4'] = ''; $_SESSION['input']['5'] = ''; $_SESSION['input']['6'] = ''; echo 'Het bedrag is: ' . number_format(calculate($_SESSION['input']), 2, ',', '.') . ' euro.<br>'; // VOORBEELD 2: $_SESSION = array(); // simuleren van een SESSION array $_SESSION['input']['1'] = 'NEE'; $_SESSION['input']['2'] = ''; $_SESSION['input']['3'] = 'JA'; $_SESSION['input']['4'] = 'JA'; $_SESSION['input']['5'] = 'NEE'; $_SESSION['input']['6'] = ''; echo 'Het bedrag is: ' . number_format(calculate($_SESSION['input']), 2, ',', '.') . ' euro.'; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/89raD
function name:  (null)
number of ops:  81
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   FETCH_W                      global              $0      '_SESSION'
          1        ASSIGN                                                   $0, <array>
   11     2        FETCH_W                      global              $2      '_SESSION'
          3        FETCH_DIM_W                                      $3      $2, 'input'
          4        ASSIGN_DIM                                               $3, 1
          5        OP_DATA                                                  'JA'
   12     6        FETCH_W                      global              $5      '_SESSION'
          7        FETCH_DIM_W                                      $6      $5, 'input'
          8        ASSIGN_DIM                                               $6, 2
          9        OP_DATA                                                  ''
   13    10        FETCH_W                      global              $8      '_SESSION'
         11        FETCH_DIM_W                                      $9      $8, 'input'
         12        ASSIGN_DIM                                               $9, 3
         13        OP_DATA                                                  'JA'
   14    14        FETCH_W                      global              $11     '_SESSION'
         15        FETCH_DIM_W                                      $12     $11, 'input'
         16        ASSIGN_DIM                                               $12, 4
         17        OP_DATA                                                  ''
   15    18        FETCH_W                      global              $14     '_SESSION'
         19        FETCH_DIM_W                                      $15     $14, 'input'
         20        ASSIGN_DIM                                               $15, 5
         21        OP_DATA                                                  ''
   16    22        FETCH_W                      global              $17     '_SESSION'
         23        FETCH_DIM_W                                      $18     $17, 'input'
         24        ASSIGN_DIM                                               $18, 6
         25        OP_DATA                                                  ''
   18    26        INIT_FCALL                                               'number_format'
         27        INIT_FCALL                                               'calculate'
         28        FETCH_R                      global              ~20     '_SESSION'
         29        FETCH_DIM_R                                      ~21     ~20, 'input'
         30        SEND_VAL                                                 ~21
         31        DO_FCALL                                      0  $22     
         32        SEND_VAR                                                 $22
         33        SEND_VAL                                                 2
         34        SEND_VAL                                                 '%2C'
         35        SEND_VAL                                                 '.'
         36        DO_ICALL                                         $23     
         37        CONCAT                                           ~24     'Het+bedrag+is%3A+', $23
         38        CONCAT                                           ~25     ~24, '+euro.%3Cbr%3E'
         39        ECHO                                                     ~25
   22    40        FETCH_W                      global              $26     '_SESSION'
         41        ASSIGN                                                   $26, <array>
   23    42        FETCH_W                      global              $28     '_SESSION'
         43        FETCH_DIM_W                                      $29     $28, 'input'
         44        ASSIGN_DIM                                               $29, 1
         45        OP_DATA                                                  'NEE'
   24    46        FETCH_W                      global              $31     '_SESSION'
         47        FETCH_DIM_W                                      $32     $31, 'input'
         48        ASSIGN_DIM                                               $32, 2
         49        OP_DATA                                                  ''
   25    50        FETCH_W                      global              $34     '_SESSION'
         51        FETCH_DIM_W                                      $35     $34, 'input'
         52        ASSIGN_DIM                                               $35, 3
         53        OP_DATA                                                  'JA'
   26    54        FETCH_W                      global              $37     '_SESSION'
         55        FETCH_DIM_W                                      $38     $37, 'input'
         56        ASSIGN_DIM                                               $38, 4
         57        OP_DATA                                                  'JA'
   27    58        FETCH_W                      global              $40     '_SESSION'
         59        FETCH_DIM_W                                      $41     $40, 'input'
         60        ASSIGN_DIM                                               $41, 5
         61        OP_DATA                                                  'NEE'
   28    62        FETCH_W                      global              $43     '_SESSION'
         63        FETCH_DIM_W                                      $44     $43, 'input'
         64        ASSIGN_DIM                                               $44, 6
         65        OP_DATA                                                  ''
   30    66        INIT_FCALL                                               'number_format'
         67        INIT_FCALL                                               'calculate'
         68        FETCH_R                      global              ~46     '_SESSION'
         69        FETCH_DIM_R                                      ~47     ~46, 'input'
         70        SEND_VAL                                                 ~47
         71        DO_FCALL                                      0  $48     
         72        SEND_VAR                                                 $48
         73        SEND_VAL                                                 2
         74        SEND_VAL                                                 '%2C'
         75        SEND_VAL                                                 '.'
         76        DO_ICALL                                         $49     
         77        CONCAT                                           ~50     'Het+bedrag+is%3A+', $49
         78        CONCAT                                           ~51     ~50, '+euro.'
         79        ECHO                                                     ~51
   32    80      > RETURN                                                   1

Function calculate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 8
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/89raD
function name:  calculate
number of ops:  18
compiled vars:  !0 = $input, !1 = $count, !2 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ASSIGN                                                   !1, 0
    4     2      > FE_RESET_R                                       $4      !0, ->9
          3    > > FE_FETCH_R                                               $4, !2, ->9
          4    >   ISSET_ISEMPTY_CV                                 ~5      !2
          5        BOOL_NOT                                         ~6      ~5
          6      > JMPZ                                                     ~6, ->8
          7    >   PRE_INC                                                  !1
          8    > > JMP                                                      ->3
          9    >   FE_FREE                                                  $4
    5    10        IS_SMALLER                                               !1, 3
         11      > JMPZ                                                     ~8, ->15
         12    >   MUL                                              ~9      !1, 8.5
         13        QM_ASSIGN                                        ~10     ~9
         14      > JMP                                                      ->16
         15    >   QM_ASSIGN                                        ~10     20
         16    > > RETURN                                                   ~10
    6    17*     > RETURN                                                   null

End of function calculate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.91 ms | 1398 KiB | 17 Q