3v4l.org

run code in 300+ PHP versions simultaneously
<?php $std1 = new stdclass(); $std1->id = 0; $std2 = new stdclass(); $std2->id = 1; $previous = array($std1); $new = array($std1, $std2); function compareThem($a, $b) { $diff = $a->id - $b->id; if ($diff < 0) { return -1; } if ($diff > 0) { return 1; } return 0; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GD1sP
function name:  (null)
number of ops:  16
compiled vars:  !0 = $std1, !1 = $std2, !2 = $previous, !3 = $new
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $4      'stdclass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
    4     3        ASSIGN_OBJ                                               !0, 'id'
          4        OP_DATA                                                  0
    5     5        NEW                                              $8      'stdclass'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $8
    6     8        ASSIGN_OBJ                                               !1, 'id'
          9        OP_DATA                                                  1
    7    10        INIT_ARRAY                                       ~12     !0
         11        ASSIGN                                                   !2, ~12
    8    12        INIT_ARRAY                                       ~14     !0
         13        ADD_ARRAY_ELEMENT                                ~14     !1
         14        ASSIGN                                                   !3, ~14
   23    15      > RETURN                                                   1

Function comparethem:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GD1sP
function name:  compareThem
number of ops:  14
compiled vars:  !0 = $a, !1 = $b, !2 = $diff
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        FETCH_OBJ_R                                      ~3      !0, 'id'
          3        FETCH_OBJ_R                                      ~4      !1, 'id'
          4        SUB                                              ~5      ~3, ~4
          5        ASSIGN                                                   !2, ~5
   14     6        IS_SMALLER                                               !2, 0
          7      > JMPZ                                                     ~7, ->9
   15     8    > > RETURN                                                   -1
   18     9    >   IS_SMALLER                                               0, !2
         10      > JMPZ                                                     ~8, ->12
   19    11    > > RETURN                                                   1
   22    12    > > RETURN                                                   0
   23    13*     > RETURN                                                   null

End of function comparethem

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.77 ms | 940 KiB | 14 Q