3v4l.org

run code in 300+ PHP versions simultaneously
<?php $itemFullName = "10-16X4 POLI MG SELF START BLK PLASTIC"; $itemAttributes = preg_replace("@POLI.++BLK@", "#", $itemFullName); echo 'Regex: ' . $itemAttributes . "\n"; if (false !== ($start = strpos($itemFullName, 'POLI')) && false !== ($end = strpos($itemFullName, 'BLK', $start))) { $itemAttributes = substr($itemFullName, 0, $start + 4) . ' # ' . substr($itemFullName, 0, $start + 4); echo "strpos()/substr(): " . $itemAttributes; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 17, Position 2 = 25
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 43
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
Branch analysis from position: 25
filename:       /in/XfdFJ
function name:  (null)
number of ops:  44
compiled vars:  !0 = $itemFullName, !1 = $itemAttributes, !2 = $start, !3 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '10-16X4+POLI+MG+SELF+START+BLK+PLASTIC'
    5     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%40POLI.%2B%2BBLK%40'
          3        SEND_VAL                                                 '%23'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !1, $5
    7     7        CONCAT                                           ~7      'Regex%3A+', !1
          8        CONCAT                                           ~8      ~7, '%0A'
          9        ECHO                                                     ~8
    9    10        INIT_FCALL                                               'strpos'
         11        SEND_VAR                                                 !0
         12        SEND_VAL                                                 'POLI'
         13        DO_ICALL                                         $9      
         14        ASSIGN                                           ~10     !2, $9
         15        TYPE_CHECK                                  1018  ~11     ~10
         16      > JMPZ_EX                                          ~11     ~11, ->25
         17    >   INIT_FCALL                                               'strpos'
         18        SEND_VAR                                                 !0
         19        SEND_VAL                                                 'BLK'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                         $12     
         22        ASSIGN                                           ~13     !3, $12
         23        TYPE_CHECK                                  1018  ~14     ~13
         24        BOOL                                             ~11     ~14
         25    > > JMPZ                                                     ~11, ->43
   10    26    >   INIT_FCALL                                               'substr'
         27        SEND_VAR                                                 !0
         28        SEND_VAL                                                 0
         29        ADD                                              ~15     !2, 4
         30        SEND_VAL                                                 ~15
         31        DO_ICALL                                         $16     
         32        CONCAT                                           ~17     $16, '+%23+'
         33        INIT_FCALL                                               'substr'
         34        SEND_VAR                                                 !0
         35        SEND_VAL                                                 0
         36        ADD                                              ~18     !2, 4
         37        SEND_VAL                                                 ~18
         38        DO_ICALL                                         $19     
         39        CONCAT                                           ~20     ~17, $19
         40        ASSIGN                                                   !1, ~20
   11    41        CONCAT                                           ~22     'strpos%28%29%2Fsubstr%28%29%3A+', !1
         42        ECHO                                                     ~22
   12    43    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.27 ms | 1392 KiB | 19 Q