3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str1 = 'key1:val1;key2:val2;key3:val3'; $str2 = 'key1:val1;key2:val2;key3:val3;'; function to_arr($str){ $array = array(); preg_match_all('/(.*?):(.*?);/',$str,$matches); foreach($matches[1]as$key=>$val){ $array[$val] = $matches[2][$key]; } return($array); } $arr1 = to_arr($str1); $arr2 = to_arr($str2); print_r($arr1); print_r($arr2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5HAco
function name:  (null)
number of ops:  17
compiled vars:  !0 = $str1, !1 = $str2, !2 = $arr1, !3 = $arr2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'key1%3Aval1%3Bkey2%3Aval2%3Bkey3%3Aval3'
    4     1        ASSIGN                                                   !1, 'key1%3Aval1%3Bkey2%3Aval2%3Bkey3%3Aval3%3B'
   15     2        INIT_FCALL                                               'to_arr'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $6      
          5        ASSIGN                                                   !2, $6
   16     6        INIT_FCALL                                               'to_arr'
          7        SEND_VAR                                                 !1
          8        DO_FCALL                                      0  $8      
          9        ASSIGN                                                   !3, $8
   17    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
   18    13        INIT_FCALL                                               'print_r'
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function to_arr:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/5HAco
function name:  to_arr
number of ops:  19
compiled vars:  !0 = $str, !1 = $array, !2 = $matches, !3 = $val, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        ASSIGN                                                   !1, <array>
    8     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAL                                                 '%2F%28.%2A%3F%29%3A%28.%2A%3F%29%3B%2F'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
    9     7        FETCH_DIM_R                                      ~7      !2, 1
          8      > FE_RESET_R                                       $8      ~7, ->16
          9    > > FE_FETCH_R                                       ~9      $8, !3, ->16
         10    >   ASSIGN                                                   !4, ~9
   10    11        FETCH_DIM_R                                      ~12     !2, 2
         12        FETCH_DIM_R                                      ~13     ~12, !4
         13        ASSIGN_DIM                                               !1, !3
         14        OP_DATA                                                  ~13
    9    15      > JMP                                                      ->9
         16    >   FE_FREE                                                  $8
   12    17      > RETURN                                                   !1
   13    18*     > RETURN                                                   null

End of function to_arr

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.5 ms | 1019 KiB | 17 Q