3v4l.org

run code in 500+ PHP versions simultaneously
<?php function loancalc() { $result = '0.00'; /** testing **/ $_POST['submit'] = true; $_POST['principal'] = "7500.50"; $_POST['interest'] = "0.22"; $_POST['tenure'] = "7.7"; /** end testing **/ if( isset( $_POST['submit'] )){ // inspecting submitted values so that... foreach ($_POST as $key => $value) { $bool[$key] = ctype_print( $value ); } // ... if proven valid, then make assignments if ( $bool['principal'] && $bool['interest'] && $bool['tenure'] ) { [$principal, $interestRate,$tenure] = [$_POST['principal'], $_POST['interest'], $_POST['tenure']]; $result = $principal * $interestRate * $tenure; } echo number_format( $result,2,'.',',' ); // default English representation } // if posted ... }// end func loancalc();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p2SSu
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   30     0  E >   INIT_FCALL                                                   'loancalc'
          1        DO_FCALL                                          0          
          2      > RETURN                                                       1

Function loancalc:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 61
Branch analysis from position: 16
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 26
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 26
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 26
2 jumps found. (Code = 46) Position 1 = 29, Position 2 = 31
Branch analysis from position: 29
2 jumps found. (Code = 46) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 54
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 54
Branch analysis from position: 34
Branch analysis from position: 31
Branch analysis from position: 26
Branch analysis from position: 61
filename:       /in/p2SSu
function name:  loancalc
number of ops:  62
compiled vars:  !0 = $result, !1 = $value, !2 = $key, !3 = $bool, !4 = $principal, !5 = $interestRate, !6 = $tenure
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                       !0, '0.00'
    7     1        FETCH_W                          global              $8      '_POST'
          2        ASSIGN_DIM                                                   $8, 'submit'
          3        OP_DATA                                                      <true>
    8     4        FETCH_W                          global              $10     '_POST'
          5        ASSIGN_DIM                                                   $10, 'principal'
          6        OP_DATA                                                      '7500.50'
    9     7        FETCH_W                          global              $12     '_POST'
          8        ASSIGN_DIM                                                   $12, 'interest'
          9        OP_DATA                                                      '0.22'
   10    10        FETCH_W                          global              $14     '_POST'
         11        ASSIGN_DIM                                                   $14, 'tenure'
         12        OP_DATA                                                      '7.7'
   13    13        FETCH_IS                                             ~16     '_POST'
         14        ISSET_ISEMPTY_DIM_OBJ                             0          ~16, 'submit'
         15      > JMPZ                                                         ~17, ->61
   15    16    >   FETCH_R                          global              ~18     '_POST'
         17      > FE_RESET_R                                           $19     ~18, ->26
         18    > > FE_FETCH_R                                           ~20     $19, !1, ->26
         19    >   ASSIGN                                                       !2, ~20
   16    20        INIT_FCALL                                                   'ctype_print'
         21        SEND_VAR                                                     !1
         22        DO_ICALL                                             $23     
         23        ASSIGN_DIM                                                   !3, !2
         24        OP_DATA                                                      $23
   15    25      > JMP                                                          ->18
         26    >   FE_FREE                                                      $19
   19    27        FETCH_DIM_R                                          ~24     !3, 'principal'
         28      > JMPZ_EX                                              ~24     ~24, ->31
         29    >   FETCH_DIM_R                                          ~25     !3, 'interest'
         30        BOOL                                                 ~24     ~25
         31    > > JMPZ_EX                                              ~24     ~24, ->34
         32    >   FETCH_DIM_R                                          ~26     !3, 'tenure'
         33        BOOL                                                 ~24     ~26
         34    > > JMPZ                                                         ~24, ->54
   20    35    >   FETCH_R                          global              ~27     '_POST'
         36        FETCH_DIM_R                                          ~28     ~27, 'principal'
         37        INIT_ARRAY                                           ~29     ~28
   21    38        FETCH_R                          global              ~30     '_POST'
         39        FETCH_DIM_R                                          ~31     ~30, 'interest'
         40        ADD_ARRAY_ELEMENT                                    ~29     ~31
   22    41        FETCH_R                          global              ~32     '_POST'
         42        FETCH_DIM_R                                          ~33     ~32, 'tenure'
         43        ADD_ARRAY_ELEMENT                                    ~29     ~33
         44        FETCH_LIST_R                                         $34     ~29, 0
   20    45        ASSIGN                                                       !4, $34
         46        FETCH_LIST_R                                         $36     ~29, 1
         47        ASSIGN                                                       !5, $36
         48        FETCH_LIST_R                                         $38     ~29, 2
         49        ASSIGN                                                       !6, $38
         50        FREE                                                         ~29
   23    51        MUL                                                  ~40     !4, !5
         52        MUL                                                  ~41     !6, ~40
         53        ASSIGN                                                       !0, ~41
   25    54    >   INIT_FCALL                                                   'number_format'
         55        SEND_VAR                                                     !0
         56        SEND_VAL                                                     2
         57        SEND_VAL                                                     '.'
         58        SEND_VAL                                                     '%2C'
         59        DO_ICALL                                             $43     
         60        ECHO                                                         $43
   27    61    > > RETURN                                                       null

End of function loancalc

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
242.63 ms | 3120 KiB | 16 Q