3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = '{Test1|Test2} {Test3|Test4}'; $finalArray = array(); $asArr = explode( '} {', $string ); $find = ['{', '}']; $replace = ['', '']; foreach( $asArr as $val ){ $val = str_replace($find, $replace, $val); $tmp = explode( '|', $val ); $finalArray[ $tmp[0] ] = $tmp[1]; } echo '<pre>'; print_r($finalArray); echo '</pre>';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 24
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 24
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/oK7uT
function name:  (null)
number of ops:  31
compiled vars:  !0 = $string, !1 = $finalArray, !2 = $asArr, !3 = $find, !4 = $replace, !5 = $val, !6 = $tmp
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '%7BTest1%7CTest2%7D+%7BTest3%7CTest4%7D'
    3     1        ASSIGN                                                       !1, <array>
    4     2        INIT_FCALL                                                   'explode'
          3        SEND_VAL                                                     '%7D+%7B'
          4        SEND_VAR                                                     !0
          5        DO_ICALL                                             $9      
          6        ASSIGN                                                       !2, $9
    5     7        ASSIGN                                                       !3, <array>
    6     8        ASSIGN                                                       !4, <array>
    7     9      > FE_RESET_R                                           $13     !2, ->24
         10    > > FE_FETCH_R                                                   $13, !5, ->24
    8    11    >   FRAMELESS_ICALL_3                str_replace         ~14     !3, !4
         12        OP_DATA                                                      !5
         13        ASSIGN                                                       !5, ~14
    9    14        INIT_FCALL                                                   'explode'
         15        SEND_VAL                                                     '%7C'
         16        SEND_VAR                                                     !5
         17        DO_ICALL                                             $16     
         18        ASSIGN                                                       !6, $16
   10    19        FETCH_DIM_R                                          ~18     !6, 0
         20        FETCH_DIM_R                                          ~20     !6, 1
         21        ASSIGN_DIM                                                   !1, ~18
         22        OP_DATA                                                      ~20
    7    23      > JMP                                                          ->10
         24    >   FE_FREE                                                      $13
   13    25        ECHO                                                         '%3Cpre%3E'
   14    26        INIT_FCALL                                                   'print_r'
         27        SEND_VAR                                                     !1
         28        DO_ICALL                                                     
   15    29        ECHO                                                         '%3C%2Fpre%3E'
         30      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
170.73 ms | 2248 KiB | 15 Q