3v4l.org

run code in 300+ PHP versions simultaneously
<?php function parseQuery($query, &$parameters) { $query = preg_replace_callback('/(?J)(?<k>\w+):(?:(?<v>\w+)|"(?<v>[^"]+?)")/', function ($match) use (&$parameters) { $parameters[$match['k']] = $match['v']; }, $query); return array_filter(explode(' ', $query)); } var_dump(parseQuery('hello world user:12345 foo said:"go eat a phallus" bar', $parameters), $parameters);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/22Wta
function name:  (null)
number of ops:  9
compiled vars:  !0 = $parameters
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'parsequery'
          2        SEND_VAL                                                 'hello+world+user%3A12345+foo+said%3A%22go+eat+a+phallus%22+bar'
          3        SEND_REF                                                 !0
          4        DO_FCALL                                      0  $1      
          5        SEND_VAR                                                 $1
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function parsequery:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/22Wta
function name:  parseQuery
number of ops:  19
compiled vars:  !0 = $query, !1 = $parameters
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'preg_replace_callback'
          3        SEND_VAL                                                 '%2F%28%3FJ%29%28%3F%3Ck%3E%5Cw%2B%29%3A%28%3F%3A%28%3F%3Cv%3E%5Cw%2B%29%7C%22%28%3F%3Cv%3E%5B%5E%22%5D%2B%3F%29%22%29%2F'
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F22Wta%3A5%240'
          5        BIND_LEXICAL                                             ~2, !1
    7     6        SEND_VAL                                                 ~2
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $3      
    5     9        ASSIGN                                                   !0, $3
    8    10        INIT_FCALL                                               'array_filter'
         11        INIT_FCALL                                               'explode'
         12        SEND_VAL                                                 '+'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $5      
         15        SEND_VAR                                                 $5
         16        DO_ICALL                                         $6      
         17      > RETURN                                                   $6
    9    18*     > RETURN                                                   null

End of function parsequery

Function %00%7Bclosure%7D%2Fin%2F22Wta%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/22Wta
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $match, !1 = $parameters
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    6     2        FETCH_DIM_R                                      ~2      !0, 'k'
          3        FETCH_DIM_R                                      ~4      !0, 'v'
          4        ASSIGN_DIM                                               !1, ~2
          5        OP_DATA                                                  ~4
    7     6      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F22Wta%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.82 ms | 1403 KiB | 22 Q