3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_diff_objects (array $array1, array ... $arrays): array { $arrays[] = function (object $a, object $b) { if ($a === $b) { return 0; } return spl_object_id($a) > spl_object_id($b) ? -1 : 1; }; return array_udiff($array1, ... $arrays); } class C {} $a = new C; $a->foo = 'aa'; $b = new C; $b->foo = 'bb'; $c = new C; $c->foo = 'cc'; var_dump(array_diff_objects([$b, $a, $c], [$c, $b]));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lWH0C
function name:  (null)
number of ops:  28
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $3      'C'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
          3        ASSIGN_OBJ                                               !0, 'foo'
          4        OP_DATA                                                  'aa'
   21     5        NEW                                              $7      'C'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $7
          8        ASSIGN_OBJ                                               !1, 'foo'
          9        OP_DATA                                                  'bb'
   22    10        NEW                                              $11     'C'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !2, $11
         13        ASSIGN_OBJ                                               !2, 'foo'
         14        OP_DATA                                                  'cc'
   24    15        INIT_FCALL                                               'var_dump'
         16        INIT_FCALL                                               'array_diff_objects'
         17        INIT_ARRAY                                       ~15     !1
         18        ADD_ARRAY_ELEMENT                                ~15     !0
         19        ADD_ARRAY_ELEMENT                                ~15     !2
         20        SEND_VAL                                                 ~15
         21        INIT_ARRAY                                       ~16     !2
         22        ADD_ARRAY_ELEMENT                                ~16     !1
         23        SEND_VAL                                                 ~16
         24        DO_FCALL                                      0  $17     
         25        SEND_VAR                                                 $17
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Function array_diff_objects:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lWH0C
function name:  array_diff_objects
number of ops:  14
compiled vars:  !0 = $array1, !1 = $arrays
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_VARIADIC                                    !1      
    5     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FlWH0C%3A5%240'
          3        ASSIGN_DIM                                               !1
   13     4        OP_DATA                                                  ~3
   15     5        INIT_FCALL                                               'array_udiff'
          6        SEND_VAR                                                 !0
          7        SEND_UNPACK                                              !1
          8        CHECK_UNDEF_ARGS                                         
          9        DO_ICALL                                         $4      
         10        VERIFY_RETURN_TYPE                                       $4
         11      > RETURN                                                   $4
   16    12*       VERIFY_RETURN_TYPE                                       
         13*     > RETURN                                                   null

End of function array_diff_objects

Function %00%7Bclosure%7D%2Fin%2FlWH0C%3A5%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lWH0C
function name:  {closure}
number of ops:  18
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        IS_IDENTICAL                                             !0, !1
          3      > JMPZ                                                     ~2, ->5
    9     4    > > RETURN                                                   0
   12     5    >   INIT_FCALL                                               'spl_object_id'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $3      
          8        INIT_FCALL                                               'spl_object_id'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $4      
         11        IS_SMALLER                                               $4, $3
         12      > JMPZ                                                     ~5, ->15
         13    >   QM_ASSIGN                                        ~6      -1
         14      > JMP                                                      ->16
         15    >   QM_ASSIGN                                        ~6      1
         16    > > RETURN                                                   ~6
   13    17*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FlWH0C%3A5%240

Class C: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.54 ms | 1411 KiB | 21 Q