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

Function %00%7Bclosure%7D%2Fin%2FKHlAt%3A22%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/KHlAt
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   23     2        FETCH_OBJ_R                                      ~2      !0, 'attr'
          3        FETCH_OBJ_R                                      ~3      !1, 'attr'
          4        IS_EQUAL                                                 ~2, ~3
          5      > JMPZ                                                     ~4, ->8
   24     6    > > RETURN                                                   0
          7*       JMP                                                      ->9
   26     8    > > RETURN                                                   -1
   28     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FKHlAt%3A22%240

Function %00%7Bclosure%7D%2Fin%2FKHlAt%3A30%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/KHlAt
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   31     2        FETCH_OBJ_R                                      ~2      !0, 'attr'
          3        FETCH_OBJ_R                                      ~3      !1, 'attr'
          4        IS_EQUAL                                                 ~2, ~3
          5      > JMPZ                                                     ~4, ->8
   32     6    > > RETURN                                                   0
          7*       JMP                                                      ->9
   34     8    > > RETURN                                                   1
   36     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FKHlAt%3A30%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.73 ms | 1392 KiB | 17 Q