3v4l.org

run code in 300+ PHP versions simultaneously
<?php $obj1 = new stdClass(); $obj1->attr = 'Rod'; $obj2 = new stdClass(); $obj2->attr = 'Jane'; $obj3 = new stdClass(); $obj3->attr = 'Freddy'; $array1 = array( $obj1, $obj2, $obj3 ); $array2 = array( $obj1, $obj3, $obj2 ); //$diff1 = array_diff($array1, $array2); $diff2 = array_udiff($array1, $array2, function($a,$b) { if ($a->attr == $b->attr) { return 0; } else { return -1; } }); $diff3 = array_udiff($array1, $array2, function($a,$b) { if ($a->attr == $b->attr) { return 0; } else { return 1; } }); $int = array_intersect($array1, $array2); //var_dump($diff1); var_dump($diff2); var_dump($diff3);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FFAer
function name:  (null)
number of ops:  49
compiled vars:  !0 = $obj1, !1 = $obj2, !2 = $obj3, !3 = $array1, !4 = $array2, !5 = $diff2, !6 = $diff3, !7 = $int
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $8      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $8
    4     3        ASSIGN_OBJ                                               !0, 'attr'
          4        OP_DATA                                                  'Rod'
    6     5        NEW                                              $12     'stdClass'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $12
    7     8        ASSIGN_OBJ                                               !1, 'attr'
          9        OP_DATA                                                  'Jane'
    9    10        NEW                                              $16     'stdClass'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !2, $16
   10    13        ASSIGN_OBJ                                               !2, 'attr'
         14        OP_DATA                                                  'Freddy'
   13    15        INIT_ARRAY                                       ~20     !0
   14    16        ADD_ARRAY_ELEMENT                                ~20     !1
   15    17        ADD_ARRAY_ELEMENT                                ~20     !2
   12    18        ASSIGN                                                   !3, ~20
   19    19        INIT_ARRAY                                       ~22     !0
   20    20        ADD_ARRAY_ELEMENT                                ~22     !2
   21    21        ADD_ARRAY_ELEMENT                                ~22     !1
   18    22        ASSIGN                                                   !4, ~22
   25    23        INIT_FCALL                                               'array_udiff'
         24        SEND_VAR                                                 !3
         25        SEND_VAR                                                 !4
         26        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FFFAer%3A25%240'
   31    27        SEND_VAL                                                 ~24
         28        DO_ICALL                                         $25     
   25    29        ASSIGN                                                   !5, $25
   33    30        INIT_FCALL                                               'array_udiff'
         31        SEND_VAR                                                 !3
         32        SEND_VAR                                                 !4
         33        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FFFAer%3A33%241'
   39    34        SEND_VAL                                                 ~27
         35        DO_ICALL                                         $28     
   33    36        ASSIGN                                                   !6, $28
   41    37        INIT_FCALL                                               'array_intersect'
         38        SEND_VAR                                                 !3
         39        SEND_VAR                                                 !4
         40        DO_ICALL                                         $30     
         41        ASSIGN                                                   !7, $30
   44    42        INIT_FCALL                                               'var_dump'
         43        SEND_VAR                                                 !5
         44        DO_ICALL                                                 
   45    45        INIT_FCALL                                               'var_dump'
         46        SEND_VAR                                                 !6
         47        DO_ICALL                                                 
         48      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FFFAer%3A25%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FFAer
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   26     2        FETCH_OBJ_R                                      ~2      !0, 'attr'
          3        FETCH_OBJ_R                                      ~3      !1, 'attr'
          4        IS_EQUAL                                                 ~2, ~3
          5      > JMPZ                                                     ~4, ->8
   27     6    > > RETURN                                                   0
          7*       JMP                                                      ->9
   29     8    > > RETURN                                                   -1
   31     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FFFAer%3A25%240

Function %00%7Bclosure%7D%2Fin%2FFFAer%3A33%241:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FFAer
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   34     2        FETCH_OBJ_R                                      ~2      !0, 'attr'
          3        FETCH_OBJ_R                                      ~3      !1, 'attr'
          4        IS_EQUAL                                                 ~2, ~3
          5      > JMPZ                                                     ~4, ->8
   35     6    > > RETURN                                                   0
          7*       JMP                                                      ->9
   37     8    > > RETURN                                                   1
   39     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FFFAer%3A33%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.22 ms | 1400 KiB | 19 Q