3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { protected function order($a, $b) { if ($a == $b) { return 0; } return ($a < $b) ? -1 : 1; } public function sortStuff($arr) { usort($arr, [$this, 'order']); return $arr; } } $f = new Foo(); print_r($f->sortStuff([5, 6, 8, 3, 7, 9]));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pG0M5
function name:  (null)
number of ops:  10
compiled vars:  !0 = $f
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   NEW                                                  $1      'Foo'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   20     3        INIT_FCALL                                                   'print_r'
          4        INIT_METHOD_CALL                                             !0, 'sortStuff'
          5        SEND_VAL_EX                                                  <array>
          6        DO_FCALL                                          0  $4      
          7        SEND_VAR                                                     $4
          8        DO_ICALL                                                     
          9      > RETURN                                                       1

Class Foo:
Function order:
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 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pG0M5
function name:  order
number of ops:  12
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    6     2        IS_EQUAL                                                     !0, !1
          3      > JMPZ                                                         ~2, ->5
    7     4    > > RETURN                                                       0
    9     5    >   IS_SMALLER                                                   !0, !1
          6      > JMPZ                                                         ~3, ->9
          7    >   QM_ASSIGN                                            ~4      -1
          8      > JMP                                                          ->10
          9    >   QM_ASSIGN                                            ~4      1
         10    > > RETURN                                                       ~4
   10    11*     > RETURN                                                       null

End of function order

Function sortstuff:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pG0M5
function name:  sortStuff
number of ops:  10
compiled vars:  !0 = $arr
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   RECV                                                 !0      
   13     1        INIT_FCALL                                                   'usort'
          2        SEND_REF                                                     !0
          3        FETCH_THIS                                           ~1      
          4        INIT_ARRAY                                           ~2      ~1
          5        ADD_ARRAY_ELEMENT                                    ~2      'order'
          6        SEND_VAL                                                     ~2
          7        DO_ICALL                                                     
   14     8      > RETURN                                                       !0
   15     9*     > RETURN                                                       null

End of function sortstuff

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.05 ms | 2229 KiB | 15 Q