3v4l.org

run code in 300+ PHP versions simultaneously
<?php function stringToAssociativeArray($string, $delimeter1, $delimeter2) { $partial = explode($delimeter1, $string); $result = array(); array_walk($partial, function($val, $key) use (&$result, &$delimeter2) { list($key, $value) = explode($delimeter2, $val); $result[$key] = $value; }); return $result; } var_dump(stringToAssociativeArray("key1:value1,key2:value2", ",", ":"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jGIsT
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'stringtoassociativearray'
          2        SEND_VAL                                                 'key1%3Avalue1%2Ckey2%3Avalue2'
          3        SEND_VAL                                                 '%2C'
          4        SEND_VAL                                                 '%3A'
          5        DO_FCALL                                      0  $0      
          6        SEND_VAR                                                 $0
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function stringtoassociativearray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jGIsT
function name:  stringToAssociativeArray
number of ops:  18
compiled vars:  !0 = $string, !1 = $delimeter1, !2 = $delimeter2, !3 = $partial, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    3     3        INIT_FCALL                                               'explode'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !3, $5
    5     8        ASSIGN                                                   !4, <array>
    6     9        INIT_FCALL                                               'array_walk'
         10        SEND_REF                                                 !3
         11        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FjGIsT%3A6%240'
         12        BIND_LEXICAL                                             ~8, !4
         13        BIND_LEXICAL                                             ~8, !2
    9    14        SEND_VAL                                                 ~8
         15        DO_ICALL                                                 
   11    16      > RETURN                                                   !4
   12    17*     > RETURN                                                   null

End of function stringtoassociativearray

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

End of function %00%7Bclosure%7D%2Fin%2FjGIsT%3A6%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.62 ms | 1403 KiB | 20 Q