3v4l.org

run code in 500+ PHP versions simultaneously
<?php define('TAX_RATES', array( 'Single' => array( 'Rates' => array(10,12,22,24,32,35,37), 'Ranges' => array(0,9700,39475,84200,160725,204100,510300), 'MinTax' => array(0, 970,4543,14382,32748,46628,153798) ), 'Married_Jointly' => array( 'Rates' => array(10,12,22,24,32,35,37), 'Ranges' => array(0,19400,78950,168400,321450,408200,612350), 'MinTax' => array(0, 1940,9086,28765,65497,93257,164709) ), 'Married_Separately' => array( 'Rates' => array(10,12,22,24,32,35,37), 'Ranges' => array(0,9700,39475,84200,160725,204100,306175), 'MinTax' => array(0, 970,4543,14382.50,32748.50,46628.50,82354.75) ), 'Head_Household' => array( 'Rates' => array(10,12,22,24,32,35,37), 'Ranges' => array(0,13850,52850,84200,160700,204100,510300), 'MinTax' => array(0, 1385,6065,12962,31322,45210,152380) ) ) ); $tableTemplate = <<<TABLE <h2>%s</h2> <table border="1"> <tr> <th>Taxable Income</th> <th>Tax Rate</th> </tr> %s </table> TABLE; $rowTemplate = <<<ROW <tr> <td>%d - %d</td> <td>%d%%</td> </tr> ROW; foreach (TAX_RATES as $status => $data) { $rows = []; foreach ($data['Rates'] as $i => $rates) { $lastRange = !$i ? 0 : $data['Ranges'][$i - 1] + 1; $rows[] = sprintf($rowTemplate, $lastRange, $data['Ranges'][$i], $rates); } printf($tableTemplate, $status, implode("\n", $rows)); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 44
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 44
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 36
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 36
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 36
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
filename:       /in/FtquV
function name:  (null)
number of ops:  46
compiled vars:  !0 = $tableTemplate, !1 = $rowTemplate, !2 = $data, !3 = $status, !4 = $rows, !5 = $rates, !6 = $i, !7 = $lastRange
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'define'
          1        SEND_VAL                                                     'TAX_RATES'
    5     2        SEND_VAL                                                     <array>
    3     3        DO_ICALL                                                     
   27     4        ASSIGN                                                       !0, '%3Ch2%3E%25s%3C%2Fh2%3E%0A%3Ctable+border%3D%221%22%3E%0A++++%3Ctr%3E%0A++++++++%3Cth%3ETaxable+Income%3C%2Fth%3E%0A++++++++%3Cth%3ETax+Rate%3C%2Fth%3E%0A++++%3C%2Ftr%3E%0A%25s%0A%3C%2Ftable%3E'
   38     5        ASSIGN                                                       !1, '++++%3Ctr%3E%0A++++++++%3Ctd%3E%25d+-+%25d%3C%2Ftd%3E%0A++++++++%3Ctd%3E%25d%25%25%3C%2Ftd%3E%0A++++%3C%2Ftr%3E'
   45     6        FETCH_CONSTANT                                       ~11     'TAX_RATES'
          7      > FE_RESET_R                                           $12     ~11, ->44
          8    > > FE_FETCH_R                                           ~13     $12, !2, ->44
          9    >   ASSIGN                                                       !3, ~13
   46    10        ASSIGN                                                       !4, <array>
   47    11        FETCH_DIM_R                                          ~16     !2, 'Rates'
         12      > FE_RESET_R                                           $17     ~16, ->36
         13    > > FE_FETCH_R                                           ~18     $17, !5, ->36
         14    >   ASSIGN                                                       !6, ~18
   48    15        BOOL_NOT                                             ~20     !6
         16      > JMPZ                                                         ~20, ->19
         17    >   QM_ASSIGN                                            ~21     0
         18      > JMP                                                          ->24
         19    >   SUB                                                  ~23     !6, 1
         20        FETCH_DIM_R                                          ~22     !2, 'Ranges'
         21        FETCH_DIM_R                                          ~24     ~22, ~23
         22        ADD                                                  ~25     ~24, 1
         23        QM_ASSIGN                                            ~21     ~25
         24    >   ASSIGN                                                       !7, ~21
   49    25        INIT_FCALL                                                   'sprintf'
         26        SEND_VAR                                                     !1
         27        SEND_VAR                                                     !7
         28        FETCH_DIM_R                                          ~28     !2, 'Ranges'
         29        FETCH_DIM_R                                          ~29     ~28, !6
         30        SEND_VAL                                                     ~29
         31        SEND_VAR                                                     !5
         32        DO_ICALL                                             $30     
         33        ASSIGN_DIM                                                   !4
         34        OP_DATA                                                      $30
   47    35      > JMP                                                          ->13
         36    >   FE_FREE                                                      $17
   51    37        INIT_FCALL                                                   'printf'
         38        SEND_VAR                                                     !0
         39        SEND_VAR                                                     !3
         40        FRAMELESS_ICALL_2                implode             ~31     '%0A', !4
         41        SEND_VAL                                                     ~31
         42        DO_ICALL                                                     
   45    43      > JMP                                                          ->8
         44    >   FE_FREE                                                      $12
   52    45      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
171.74 ms | 2346 KiB | 16 Q