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. 9mm Luger 115 gr. Target"; $grains = filter_var(substr($ammunition,$strcspn($ammunition,"gr")-4,4),FILTER_SANITIZE_NUMBER_INT); echo '['.$power_factor.'] ['.$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/CLbj1
function name:  (null)
number of ops:  32
compiled vars:  !0 = $string, !1 = $matches, !2 = $power_factor, !3 = $ammunition, !4 = $grains, !5 = $strcspn
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                                         $7      
          6      > JMPZ                                                     $7, ->9
    4     7    >   ASSIGN                                                   !2, 175
          8      > JMP                                                      ->10
    6     9    >   ASSIGN                                                   !2, 0
    8    10    >   ASSIGN                                                   !3, 'Reman.+9mm+Luger+115+gr.+Target'
    9    11        INIT_FCALL                                               'filter_var'
         12        INIT_FCALL                                               'substr'
         13        SEND_VAR                                                 !3
         14        INIT_DYNAMIC_CALL                                        !5
         15        SEND_VAR_EX                                              !3
         16        SEND_VAL_EX                                              'gr'
         17        DO_FCALL                                      0  $11     
         18        SUB                                              ~12     $11, 4
         19        SEND_VAL                                                 ~12
         20        SEND_VAL                                                 4
         21        DO_ICALL                                         $13     
         22        SEND_VAR                                                 $13
         23        SEND_VAL                                                 519
         24        DO_ICALL                                         $14     
         25        ASSIGN                                                   !4, $14
   10    26        CONCAT                                           ~16     '%5B', !2
         27        CONCAT                                           ~17     ~16, '%5D+%5B'
         28        CONCAT                                           ~18     ~17, !4
         29        CONCAT                                           ~19     ~18, '%5D'
         30        ECHO                                                     ~19
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.39 ms | 1401 KiB | 19 Q