3v4l.org

run code in 300+ PHP versions simultaneously
<?php class NameObj { public $name; function __construct($name){ $this->name = $name; } } class IdObj{ public $id; function __construct($id){ $this->id = $id; } } $idArray = array( new IdObj(1), new IdObj(2), new IdObj(3) ); $nameArray = array( new NameObj('1 - Object 1 Name'), new NameObj('2 - Object 2 Name') ); function custom_diff($oId, $oName){ $temp = $oId; $oId = $oId instanceof IdObj?$oId:$oName; $oName = $oName instanceof NameObj?$oName:$temp; $splitName = explode(' - ', $oName->name); $idFromName = $splitName[0]; $id = $oId->id; if($idFromName == $id) return 0; return $idFromName > $id ? 1 : -1; } $missing_objects = array_udiff($idArray, $nameArray, 'custom_diff'); print_r($missing_objects);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DPJiL
function name:  (null)
number of ops:  32
compiled vars:  !0 = $idArray, !1 = $nameArray, !2 = $missing_objects
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $3      'IdObj'
          1        SEND_VAL_EX                                              1
          2        DO_FCALL                                      0          
          3        INIT_ARRAY                                       ~5      $3
   23     4        NEW                                              $6      'IdObj'
          5        SEND_VAL_EX                                              2
          6        DO_FCALL                                      0          
          7        ADD_ARRAY_ELEMENT                                ~5      $6
   24     8        NEW                                              $8      'IdObj'
          9        SEND_VAL_EX                                              3
         10        DO_FCALL                                      0          
         11        ADD_ARRAY_ELEMENT                                ~5      $8
   21    12        ASSIGN                                                   !0, ~5
   28    13        NEW                                              $11     'NameObj'
         14        SEND_VAL_EX                                              '1+-+Object+1+Name'
         15        DO_FCALL                                      0          
         16        INIT_ARRAY                                       ~13     $11
   29    17        NEW                                              $14     'NameObj'
         18        SEND_VAL_EX                                              '2+-+Object+2+Name'
         19        DO_FCALL                                      0          
         20        ADD_ARRAY_ELEMENT                                ~13     $14
   27    21        ASSIGN                                                   !1, ~13
   46    22        INIT_FCALL                                               'array_udiff'
         23        SEND_VAR                                                 !0
         24        SEND_VAR                                                 !1
         25        SEND_VAL                                                 'custom_diff'
         26        DO_ICALL                                         $17     
         27        ASSIGN                                                   !2, $17
   48    28        INIT_FCALL                                               'print_r'
         29        SEND_VAR                                                 !2
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Function custom_diff:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 28
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 28
Branch analysis from position: 27
Branch analysis from position: 28
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
Branch analysis from position: 13
filename:       /in/DPJiL
function name:  custom_diff
number of ops:  35
compiled vars:  !0 = $oId, !1 = $oName, !2 = $temp, !3 = $splitName, !4 = $idFromName, !5 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   33     2        ASSIGN                                                   !2, !0
   34     3        INSTANCEOF                                               !0, 'IdObj'
          4      > JMPZ                                                     ~7, ->7
          5    >   QM_ASSIGN                                        ~8      !0
          6      > JMP                                                      ->8
          7    >   QM_ASSIGN                                        ~8      !1
          8    >   ASSIGN                                                   !0, ~8
   35     9        INSTANCEOF                                               !1, 'NameObj'
         10      > JMPZ                                                     ~10, ->13
         11    >   QM_ASSIGN                                        ~11     !1
         12      > JMP                                                      ->14
         13    >   QM_ASSIGN                                        ~11     !2
         14    >   ASSIGN                                                   !1, ~11
   37    15        INIT_FCALL                                               'explode'
         16        SEND_VAL                                                 '+-+'
         17        FETCH_OBJ_R                                      ~13     !1, 'name'
         18        SEND_VAL                                                 ~13
         19        DO_ICALL                                         $14     
         20        ASSIGN                                                   !3, $14
   38    21        FETCH_DIM_R                                      ~16     !3, 0
         22        ASSIGN                                                   !4, ~16
   40    23        FETCH_OBJ_R                                      ~18     !0, 'id'
         24        ASSIGN                                                   !5, ~18
   42    25        IS_EQUAL                                                 !4, !5
         26      > JMPZ                                                     ~20, ->28
         27    > > RETURN                                                   0
   43    28    >   IS_SMALLER                                               !5, !4
         29      > JMPZ                                                     ~21, ->32
         30    >   QM_ASSIGN                                        ~22     1
         31      > JMP                                                      ->33
         32    >   QM_ASSIGN                                        ~22     -1
         33    > > RETURN                                                   ~22
   44    34*     > RETURN                                                   null

End of function custom_diff

Class NameObj:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DPJiL
function name:  __construct
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ASSIGN_OBJ                                               'name'
          2        OP_DATA                                                  !0
    9     3      > RETURN                                                   null

End of function __construct

End of class NameObj.

Class IdObj:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DPJiL
function name:  __construct
number of ops:  4
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        ASSIGN_OBJ                                               'id'
          2        OP_DATA                                                  !0
   18     3      > RETURN                                                   null

End of function __construct

End of class IdObj.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.91 ms | 1404 KiB | 19 Q