3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arrayOfString = array( 'customer service[-3] technical support[-3]', 'picture quality[+2]feature[+2]', 'smell[-2]', 'player[+2]', 'player[-3][u]', 'dvd player[-2]', 'player[+2][p]', 'format[+2][u]progressive scan[-2]' ); preg_match_all("/([\w ]+[^[]]*)\[([+-]\d*?)\]/", implode(",", $arrayOfString) , $matches); print_r(array_combine(array_filter($matches[1], 'trim'), $matches[2]));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Lp4XP
function name:  (null)
number of ops:  24
compiled vars:  !0 = $arrayOfString, !1 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   13     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%2F%28%5B%5Cw+%5D%2B%5B%5E%5B%5D%5D%2A%29%5C%5B%28%5B%2B-%5D%5Cd%2A%3F%29%5C%5D%2F'
          3        INIT_FCALL                                               'implode'
          4        SEND_VAL                                                 '%2C'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7        SEND_VAR                                                 $3
          8        SEND_REF                                                 !1
          9        DO_ICALL                                                 
   14    10        INIT_FCALL                                               'print_r'
         11        INIT_FCALL                                               'array_combine'
         12        INIT_FCALL                                               'array_filter'
         13        FETCH_DIM_R                                      ~5      !1, 1
         14        SEND_VAL                                                 ~5
         15        SEND_VAL                                                 'trim'
         16        DO_ICALL                                         $6      
         17        SEND_VAR                                                 $6
         18        FETCH_DIM_R                                      ~7      !1, 2
         19        SEND_VAL                                                 ~7
         20        DO_ICALL                                         $8      
         21        SEND_VAR                                                 $8
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.4 ms | 1395 KiB | 23 Q