3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = "var1,'Hello'|var2,'World'|"; preg_match_all('/(?:^|\|)([^,]+),([^\|]+(?=\||$))/', $str, $matches); $new_substr = array_combine($matches[1], $matches[2]); print_r($new_substr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1iEk9
function name:  (null)
number of ops:  17
compiled vars:  !0 = $str, !1 = $matches, !2 = $new_substr
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'var1%2C%27Hello%27%7Cvar2%2C%27World%27%7C'
    4     1        INIT_FCALL                                                   'preg_match_all'
          2        SEND_VAL                                                     '%2F%28%3F%3A%5E%7C%5C%7C%29%28%5B%5E%2C%5D%2B%29%2C%28%5B%5E%5C%7C%5D%2B%28%3F%3D%5C%7C%7C%24%29%29%2F'
          3        SEND_VAR                                                     !0
          4        SEND_REF                                                     !1
          5        DO_ICALL                                                     
    5     6        INIT_FCALL                                                   'array_combine'
          7        FETCH_DIM_R                                          ~5      !1, 1
          8        SEND_VAL                                                     ~5
          9        FETCH_DIM_R                                          ~6      !1, 2
         10        SEND_VAL                                                     ~6
         11        DO_ICALL                                             $7      
         12        ASSIGN                                                       !2, $7
    6    13        INIT_FCALL                                                   'print_r'
         14        SEND_VAR                                                     !2
         15        DO_ICALL                                                     
         16      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.82 ms | 2114 KiB | 16 Q