3v4l.org

run code in 300+ PHP versions simultaneously
<?php /**** PlaceHolder to emulate file ****/ $input = <<<EOL RFHSEP34 | 20 RETBBHUJ | 10 TYRHBNNM | 5 EOL; $lookup = []; $handle = tmpfile(); fwrite($handle, $input); rewind($handle); while ($matches = fscanf($handle, "%[^ |] |%d", $discount, $amount)) { if ($matches === 2) { $lookup[$discount] = $amount; } } fclose($handle); //var_export($lookup); $_POST['disCode'] = 'RETBBHUJ'; $total = 500; $total -= $lookup[$_POST['disCode'] ?? ''] ?? 0; var_export($total);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 13
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 13
Branch analysis from position: 25
Branch analysis from position: 13
Branch analysis from position: 17
filename:       /in/J8Of7
function name:  (null)
number of ops:  44
compiled vars:  !0 = $input, !1 = $lookup, !2 = $handle, !3 = $matches, !4 = $discount, !5 = $amount, !6 = $total
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 'RFHSEP34+%7C+20+%0A%0ARETBBHUJ+%7C+10+%0A%0ATYRHBNNM+%7C+5'
   12     1        ASSIGN                                                   !1, <array>
   13     2        INIT_FCALL                                               'tmpfile'
          3        DO_ICALL                                         $9      
          4        ASSIGN                                                   !2, $9
   14     5        INIT_FCALL                                               'fwrite'
          6        SEND_VAR                                                 !2
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   15     9        INIT_FCALL                                               'rewind'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                                 
   16    12      > JMP                                                      ->17
   17    13    >   IS_IDENTICAL                                             !3, 2
         14      > JMPZ                                                     ~13, ->17
   18    15    >   ASSIGN_DIM                                               !1, !4
         16        OP_DATA                                                  !5
   16    17    >   INIT_FCALL                                               'fscanf'
         18        SEND_VAR                                                 !2
         19        SEND_VAL                                                 '%25%5B%5E+%7C%5D+%7C%25d'
         20        SEND_REF                                                 !4
         21        SEND_REF                                                 !5
         22        DO_ICALL                                         $15     
         23        ASSIGN                                           ~16     !3, $15
         24      > JMPNZ                                                    ~16, ->13
   21    25    >   INIT_FCALL                                               'fclose'
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                                 
   24    28        FETCH_W                      global              $18     '_POST'
         29        ASSIGN_DIM                                               $18, 'disCode'
         30        OP_DATA                                                  'RETBBHUJ'
   26    31        ASSIGN                                                   !6, 500
   27    32        FETCH_IS                                         ~21     '_POST'
         33        FETCH_DIM_IS                                     ~22     ~21, 'disCode'
         34        COALESCE                                         ~23     ~22
         35        QM_ASSIGN                                        ~23     ''
         36        FETCH_DIM_IS                                     ~24     !1, ~23
         37        COALESCE                                         ~25     ~24
         38        QM_ASSIGN                                        ~25     0
         39        ASSIGN_OP                                     2          !6, ~25
   28    40        INIT_FCALL                                               'var_export'
         41        SEND_VAR                                                 !6
         42        DO_ICALL                                                 
         43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.93 ms | 1020 KiB | 19 Q