3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "/key/value/anotherKey/anotherValue/thirdKey/thirdValue"; $arr = explode("/", trim($string, "/")); $keys = array_flip(array_filter(array_flip($arr), function($k){ return ($k % 2 == 0); })); $values = array_flip(array_filter(array_flip($arr), function($k){ return ($k % 2 == 1); })); $result = array_combine($keys, $values); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AA3F8
function name:  (null)
number of ops:  43
compiled vars:  !0 = $string, !1 = $arr, !2 = $keys, !3 = $values, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%2Fkey%2Fvalue%2FanotherKey%2FanotherValue%2FthirdKey%2FthirdValue'
    3     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%2F'
          3        INIT_FCALL                                               'trim'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 '%2F'
          6        DO_ICALL                                         $6      
          7        SEND_VAR                                                 $6
          8        DO_ICALL                                         $7      
          9        ASSIGN                                                   !1, $7
    5    10        INIT_FCALL                                               'array_flip'
         11        INIT_FCALL                                               'array_filter'
         12        INIT_FCALL                                               'array_flip'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $9      
         15        SEND_VAR                                                 $9
         16        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FAA3F8%3A5%240'
    7    17        SEND_VAL                                                 ~10
         18        DO_ICALL                                         $11     
         19        SEND_VAR                                                 $11
         20        DO_ICALL                                         $12     
    5    21        ASSIGN                                                   !2, $12
    9    22        INIT_FCALL                                               'array_flip'
         23        INIT_FCALL                                               'array_filter'
         24        INIT_FCALL                                               'array_flip'
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                         $14     
         27        SEND_VAR                                                 $14
         28        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FAA3F8%3A9%241'
   11    29        SEND_VAL                                                 ~15
         30        DO_ICALL                                         $16     
         31        SEND_VAR                                                 $16
         32        DO_ICALL                                         $17     
    9    33        ASSIGN                                                   !3, $17
   13    34        INIT_FCALL                                               'array_combine'
         35        SEND_VAR                                                 !2
         36        SEND_VAR                                                 !3
         37        DO_ICALL                                         $19     
         38        ASSIGN                                                   !4, $19
   14    39        INIT_FCALL                                               'print_r'
         40        SEND_VAR                                                 !4
         41        DO_ICALL                                                 
         42      > RETURN                                                   1

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

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

Function %00%7Bclosure%7D%2Fin%2FAA3F8%3A9%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AA3F8
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        MOD                                              ~1      !0, 2
          2        IS_EQUAL                                         ~2      ~1, 1
          3      > RETURN                                                   ~2
   11     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FAA3F8%3A9%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.37 ms | 1392 KiB | 25 Q