3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "brand => toyota,type => suv, color => white"; $result = []; array_walk(explode(',',$text),function($v)use(&$result){ $res = explode("=>",$v); $result[trim($res[0])] = trim($res[1]); }); print_R($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KH6bZ
function name:  (null)
number of ops:  16
compiled vars:  !0 = $text, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'brand+%3D%3E+toyota%2Ctype+%3D%3E+suv%2C+color+%3D%3E+white'
    4     1        ASSIGN                                                   !1, <array>
    5     2        INIT_FCALL                                               'array_walk'
          3        INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '%2C'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $4      
          7        SEND_VAR_NO_REF                               0          $4
          8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FKH6bZ%3A5%240'
          9        BIND_LEXICAL                                             ~5, !1
    8    10        SEND_VAL                                                 ~5
         11        DO_ICALL                                                 
    9    12        INIT_FCALL                                               'print_r'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FKH6bZ%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KH6bZ
function name:  {closure}
number of ops:  18
compiled vars:  !0 = $v, !1 = $result, !2 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    6     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%3D%3E'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !2, $3
    7     7        INIT_FCALL                                               'trim'
          8        FETCH_DIM_R                                      ~5      !2, 0
          9        SEND_VAL                                                 ~5
         10        DO_ICALL                                         $6      
         11        INIT_FCALL                                               'trim'
         12        FETCH_DIM_R                                      ~8      !2, 1
         13        SEND_VAL                                                 ~8
         14        DO_ICALL                                         $9      
         15        ASSIGN_DIM                                               !1, $6
         16        OP_DATA                                                  $9
    8    17      > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.53 ms | 1396 KiB | 21 Q