3v4l.org

run code in 300+ PHP versions simultaneously
<?php function extract_name($d) { preg_match('#\[(.*?)\]#', $d, $match); return $match[1]; } $d = json_decode('[{"name":"form[id]","value":"10"},{"name":"form[name]","value":"Telefon2"},{"name":"form[uuid]","value":"bb80878ad4"},{"name":"form[productgroup]","value":"6"},{"name":"form[category]","value":"1"},{"name":"form[documents]","value":"7"}]'); $dData = array_combine(array_map('extract_name', array_column($d, 'name')), array_column($d, 'value')); $json = json_encode($dData); var_dump( $dData, $json );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MZq5D
function name:  (null)
number of ops:  30
compiled vars:  !0 = $d, !1 = $dData, !2 = $json
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'json_decode'
          1        SEND_VAL                                                 '%5B%7B%22name%22%3A%22form%5Bid%5D%22%2C%22value%22%3A%2210%22%7D%2C%7B%22name%22%3A%22form%5Bname%5D%22%2C%22value%22%3A%22Telefon2%22%7D%2C%7B%22name%22%3A%22form%5Buuid%5D%22%2C%22value%22%3A%22bb80878ad4%22%7D%2C%7B%22name%22%3A%22form%5Bproductgroup%5D%22%2C%22value%22%3A%226%22%7D%2C%7B%22name%22%3A%22form%5Bcategory%5D%22%2C%22value%22%3A%221%22%7D%2C%7B%22name%22%3A%22form%5Bdocuments%5D%22%2C%22value%22%3A%227%22%7D%5D'
          2        DO_ICALL                                         $3      
          3        ASSIGN                                                   !0, $3
   10     4        INIT_FCALL                                               'array_combine'
          5        INIT_FCALL                                               'array_map'
          6        SEND_VAL                                                 'extract_name'
          7        INIT_FCALL                                               'array_column'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 'name'
         10        DO_ICALL                                         $5      
         11        SEND_VAR                                                 $5
         12        DO_ICALL                                         $6      
         13        SEND_VAR                                                 $6
         14        INIT_FCALL                                               'array_column'
         15        SEND_VAR                                                 !0
         16        SEND_VAL                                                 'value'
         17        DO_ICALL                                         $7      
         18        SEND_VAR                                                 $7
         19        DO_ICALL                                         $8      
         20        ASSIGN                                                   !1, $8
   11    21        INIT_FCALL                                               'json_encode'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                         $10     
         24        ASSIGN                                                   !2, $10
   13    25        INIT_FCALL                                               'var_dump'
   14    26        SEND_VAR                                                 !1
   15    27        SEND_VAR                                                 !2
         28        DO_ICALL                                                 
   16    29      > RETURN                                                   1

Function extract_name:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MZq5D
function name:  extract_name
number of ops:  9
compiled vars:  !0 = $d, !1 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%23%5C%5B%28.%2A%3F%29%5C%5D%23'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
    5     6        FETCH_DIM_R                                      ~3      !1, 1
          7      > RETURN                                                   ~3
    6     8*     > RETURN                                                   null

End of function extract_name

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.71 ms | 1405 KiB | 27 Q