3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ar = Array ( 0 => (object)["a"=>"b", "c"=>"d", "h"=>"e"], 1 =>(object)["a"=>"b", "f"=>"g"] ); foreach($ar as $in=>&$obj){ $ar[$in] = (array)$obj; } $diff = array_diff($ar[1],array_diff($ar[1],$ar[0])); foreach($diff as $ind=>$uns){ unset($ar[1][$ind]); } foreach($ar as $in=>&$js){ $ar[$in] = json_encode($js); } print_r($ar);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
2 jumps found. (Code = 126) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 26, Position 2 = 31
Branch analysis from position: 26
2 jumps found. (Code = 78) Position 1 = 27, Position 2 = 31
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 31
2 jumps found. (Code = 125) Position 1 = 33, Position 2 = 41
Branch analysis from position: 33
2 jumps found. (Code = 126) Position 1 = 34, Position 2 = 41
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
Branch analysis from position: 31
Branch analysis from position: 12
filename:       /in/F9bM6
function name:  (null)
number of ops:  46
compiled vars:  !0 = $ar, !1 = $obj, !2 = $in, !3 = $diff, !4 = $uns, !5 = $ind, !6 = $js
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   CAST                                          8  ~7      <array>
          1        INIT_ARRAY                                       ~8      ~7, 0
    5     2        CAST                                          8  ~9      <array>
          3        ADD_ARRAY_ELEMENT                                ~8      ~9, 1
    3     4        ASSIGN                                                   !0, ~8
    8     5      > FE_RESET_RW                                      $11     !0, ->12
          6    > > FE_FETCH_RW                                      ~12     $11, !1, ->12
          7    >   ASSIGN                                                   !2, ~12
    9     8        CAST                                          7  ~15     !1
          9        ASSIGN_DIM                                               !0, !2
         10        OP_DATA                                                  ~15
    8    11      > JMP                                                      ->6
         12    >   FE_FREE                                                  $11
   12    13        INIT_FCALL                                               'array_diff'
         14        FETCH_DIM_R                                      ~16     !0, 1
         15        SEND_VAL                                                 ~16
         16        INIT_FCALL                                               'array_diff'
         17        FETCH_DIM_R                                      ~17     !0, 1
         18        SEND_VAL                                                 ~17
         19        FETCH_DIM_R                                      ~18     !0, 0
         20        SEND_VAL                                                 ~18
         21        DO_ICALL                                         $19     
         22        SEND_VAR                                                 $19
         23        DO_ICALL                                         $20     
         24        ASSIGN                                                   !3, $20
   14    25      > FE_RESET_R                                       $22     !3, ->31
         26    > > FE_FETCH_R                                       ~23     $22, !4, ->31
         27    >   ASSIGN                                                   !5, ~23
   15    28        FETCH_DIM_UNSET                                  $25     !0, 1
         29        UNSET_DIM                                                $25, !5
   14    30      > JMP                                                      ->26
         31    >   FE_FREE                                                  $22
   18    32      > FE_RESET_RW                                      $26     !0, ->41
         33    > > FE_FETCH_RW                                      ~27     $26, !6, ->41
         34    >   ASSIGN                                                   !2, ~27
   19    35        INIT_FCALL                                               'json_encode'
         36        SEND_VAR                                                 !6
         37        DO_ICALL                                         $30     
         38        ASSIGN_DIM                                               !0, !2
         39        OP_DATA                                                  $30
   18    40      > JMP                                                      ->33
         41    >   FE_FREE                                                  $26
   22    42        INIT_FCALL                                               'print_r'
         43        SEND_VAR                                                 !0
         44        DO_ICALL                                                 
         45      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.7 ms | 1005 KiB | 16 Q