3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array_1 = array("1a-dogs","2a-cats","3a-birds","4a-people"); $array_2 = array("4a-walking","2a-cats"); function splitArray ($arrayInput) { $arrayOutput = array(); foreach ($array_1 as $element) { $tempArray = explode('-', $array_1); $arrayOutput[$tempArray[0]] = $tempArray[1]; } return $arrayOutput; } $arraySplit1 = splitArray($array_1); $arraySplit2 = splitArray($array_2); print_r($arraySplit1); print_r($arraySplit2); foreach ($arraySplit1 as $key1 => $value1) { if (array_key_exists($key1, $arraySplit2)) { $arraySplit1[$key1] = $arraySplit2[$key1]; } } print_r($arraySplit1);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 25
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 25
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 24
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/o74V1
function name:  (null)
number of ops:  30
compiled vars:  !0 = $array_1, !1 = $array_2, !2 = $arraySplit1, !3 = $arraySplit2, !4 = $value1, !5 = $key1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, <array>
   15     2        INIT_FCALL                                               'splitarray'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $8      
          5        ASSIGN                                                   !2, $8
   16     6        INIT_FCALL                                               'splitarray'
          7        SEND_VAR                                                 !1
          8        DO_FCALL                                      0  $10     
          9        ASSIGN                                                   !3, $10
   18    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
   19    13        INIT_FCALL                                               'print_r'
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                                 
   21    16      > FE_RESET_R                                       $14     !2, ->25
         17    > > FE_FETCH_R                                       ~15     $14, !4, ->25
         18    >   ASSIGN                                                   !5, ~15
   22    19        ARRAY_KEY_EXISTS                                         !5, !3
         20      > JMPZ                                                     ~17, ->24
   23    21    >   FETCH_DIM_R                                      ~19     !3, !5
         22        ASSIGN_DIM                                               !2, !5
         23        OP_DATA                                                  ~19
   21    24    > > JMP                                                      ->17
         25    >   FE_FREE                                                  $14
   27    26        INIT_FCALL                                               'print_r'
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Function splitarray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/o74V1
function name:  splitArray
number of ops:  17
compiled vars:  !0 = $arrayInput, !1 = $arrayOutput, !2 = $array_1, !3 = $element, !4 = $tempArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        ASSIGN                                                   !1, <array>
    8     2      > FE_RESET_R                                       $6      !2, ->14
          3    > > FE_FETCH_R                                               $6, !3, ->14
    9     4    >   INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '-'
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !4, $7
   10     9        FETCH_DIM_R                                      ~9      !4, 0
         10        FETCH_DIM_R                                      ~11     !4, 1
         11        ASSIGN_DIM                                               !1, ~9
         12        OP_DATA                                                  ~11
    8    13      > JMP                                                      ->3
         14    >   FE_FREE                                                  $6
   12    15      > RETURN                                                   !1
   13    16*     > RETURN                                                   null

End of function splitarray

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.94 ms | 1403 KiB | 19 Q