3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ (object) [ 'trainerid' => 1, 'firstname' => 'abc', 'location' => 'area', 'photo' => 'abc.jpg', 'role' => 'user', 'city' => 'bangalore', ], (object) [ 'trainerid' => 2, 'firstname' => 'abcd', 'location' => 'area', 'photo' => 'abcd.jpg', 'role' => 'user', 'city' => 'bangalore', ], ]; $array2 = [ (object) [ 'rating' => 3.0000, 'users' => 0, 'review' => 0 ], (object) [ 'rating' => 4.0000, 'users' => 4, 'review' => 5 ] ]; $result = []; foreach ($array1 as $i => $obj1) { $result[$i] = $obj1; foreach ($array2[$i] as $k => $v) { $result[$i]->$k = $v; } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 26
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 26
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 24
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 24
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 24
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/RGeR0
function name:  (null)
number of ops:  31
compiled vars:  !0 = $array1, !1 = $array2, !2 = $result, !3 = $obj1, !4 = $i, !5 = $v, !6 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   CAST                                          8  ~7      <array>
          1        INIT_ARRAY                                       ~8      ~7
   13     2        CAST                                          8  ~9      <array>
          3        ADD_ARRAY_ELEMENT                                ~8      ~9
    3     4        ASSIGN                                                   !0, ~8
   24     5        CAST                                          8  ~11     <array>
          6        INIT_ARRAY                                       ~12     ~11
   29     7        CAST                                          8  ~13     <array>
          8        ADD_ARRAY_ELEMENT                                ~12     ~13
   22     9        ASSIGN                                                   !1, ~12
   35    10        ASSIGN                                                   !2, <array>
   36    11      > FE_RESET_R                                       $16     !0, ->26
         12    > > FE_FETCH_R                                       ~17     $16, !3, ->26
         13    >   ASSIGN                                                   !4, ~17
   37    14        ASSIGN_DIM                                               !2, !4
         15        OP_DATA                                                  !3
   38    16        FETCH_DIM_R                                      ~20     !1, !4
         17      > FE_RESET_R                                       $21     ~20, ->24
         18    > > FE_FETCH_R                                       ~22     $21, !5, ->24
         19    >   ASSIGN                                                   !6, ~22
   39    20        FETCH_DIM_W                                      $24     !2, !4
         21        ASSIGN_OBJ                                               $24, !6
         22        OP_DATA                                                  !5
   38    23      > JMP                                                      ->18
         24    >   FE_FREE                                                  $21
   36    25      > JMP                                                      ->12
         26    >   FE_FREE                                                  $16
   42    27        INIT_FCALL                                               'var_export'
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.46 ms | 998 KiB | 14 Q