3v4l.org

run code in 300+ PHP versions simultaneously
<?php $original = array ( array ("title" => "one", "color" => "blue" ), array ("title" => "two", "color" => "green" ) ); $merged = array(); $str = "000three000red0!000four000white0!000five000black0!"; $pat = "/\d+(\D+)\d+(\D+)\d!/um"; preg_match_all($pat, $str, $match); var_dump($match); $merged = $original; $i = 0; foreach($match[1] as $result) { $merged[] = array("title" => $match[1][$i], "color" => $match[2][$i]); $i++; } print_r($merged);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 27
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 27
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/Evp0q
function name:  (null)
number of ops:  32
compiled vars:  !0 = $original, !1 = $merged, !2 = $str, !3 = $pat, !4 = $match, !5 = $i, !6 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1        ASSIGN                                                   !1, <array>
   15     2        ASSIGN                                                   !2, '000three000red0%21000four000white0%21000five000black0%21'
   16     3        ASSIGN                                                   !3, '%2F%5Cd%2B%28%5CD%2B%29%5Cd%2B%28%5CD%2B%29%5Cd%21%2Fum'
   18     4        INIT_FCALL                                               'preg_match_all'
          5        SEND_VAR                                                 !3
          6        SEND_VAR                                                 !2
          7        SEND_REF                                                 !4
          8        DO_ICALL                                                 
   20     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !4
         11        DO_ICALL                                                 
   22    12        ASSIGN                                                   !1, !0
   23    13        ASSIGN                                                   !5, 0
   24    14        FETCH_DIM_R                                      ~15     !4, 1
         15      > FE_RESET_R                                       $16     ~15, ->27
         16    > > FE_FETCH_R                                               $16, !6, ->27
   25    17    >   FETCH_DIM_R                                      ~18     !4, 1
         18        FETCH_DIM_R                                      ~19     ~18, !5
         19        INIT_ARRAY                                       ~20     ~19, 'title'
         20        FETCH_DIM_R                                      ~21     !4, 2
         21        FETCH_DIM_R                                      ~22     ~21, !5
         22        ADD_ARRAY_ELEMENT                                ~20     ~22, 'color'
         23        ASSIGN_DIM                                               !1
         24        OP_DATA                                                  ~20
   26    25        PRE_INC                                                  !5
   24    26      > JMP                                                      ->16
         27    >   FE_FREE                                                  $16
   29    28        INIT_FCALL                                               'print_r'
         29        SEND_VAR                                                 !1
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.5 ms | 1396 KiB | 19 Q