3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "Reman. 9mm Luger 125 gr. Match"; if(preg_match('/(9mm Luger|40 S&W|45 ACP)(.*Match)/',$string,$matches)){ $power_factor = 175; }else{ $power_factor = 0; } $ammunition = "Reman. .380 ACP 195 gr. Target"; $strstart = strcspn($ammunition,"gr"); $substr = substr($ammunition,$strstart-4,4); $grains = filter_var(substr($ammunition,$strstart-4,4),FILTER_SANITIZE_NUMBER_INT); echo '['.$power_factor.'] ['.$strstart.'] ['.$substr.'] ['.$grains.']';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UoEOL
function name:  (null)
number of ops:  44
compiled vars:  !0 = $string, !1 = $matches, !2 = $power_factor, !3 = $ammunition, !4 = $strstart, !5 = $substr, !6 = $grains
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'Reman.+9mm+Luger+125+gr.+Match'
    3     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%289mm+Luger%7C40+S%26W%7C45+ACP%29%28.%2AMatch%29%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                         $8      
          6      > JMPZ                                                     $8, ->9
    4     7    >   ASSIGN                                                   !2, 175
          8      > JMP                                                      ->10
    6     9    >   ASSIGN                                                   !2, 0
    8    10    >   ASSIGN                                                   !3, 'Reman.+.380+ACP+195+gr.+Target'
    9    11        INIT_FCALL                                               'strcspn'
         12        SEND_VAR                                                 !3
         13        SEND_VAL                                                 'gr'
         14        DO_ICALL                                         $12     
         15        ASSIGN                                                   !4, $12
   10    16        INIT_FCALL                                               'substr'
         17        SEND_VAR                                                 !3
         18        SUB                                              ~14     !4, 4
         19        SEND_VAL                                                 ~14
         20        SEND_VAL                                                 4
         21        DO_ICALL                                         $15     
         22        ASSIGN                                                   !5, $15
   11    23        INIT_FCALL                                               'filter_var'
         24        INIT_FCALL                                               'substr'
         25        SEND_VAR                                                 !3
         26        SUB                                              ~17     !4, 4
         27        SEND_VAL                                                 ~17
         28        SEND_VAL                                                 4
         29        DO_ICALL                                         $18     
         30        SEND_VAR                                                 $18
         31        SEND_VAL                                                 519
         32        DO_ICALL                                         $19     
         33        ASSIGN                                                   !6, $19
   12    34        CONCAT                                           ~21     '%5B', !2
         35        CONCAT                                           ~22     ~21, '%5D+%5B'
         36        CONCAT                                           ~23     ~22, !4
         37        CONCAT                                           ~24     ~23, '%5D+%5B'
         38        CONCAT                                           ~25     ~24, !5
         39        CONCAT                                           ~26     ~25, '%5D+%5B'
         40        CONCAT                                           ~27     ~26, !6
         41        CONCAT                                           ~28     ~27, '%5D'
         42        ECHO                                                     ~28
         43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
281.17 ms | 1400 KiB | 22 Q