3v4l.org

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

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

End of function spam

Function sort:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/A4Mkc
function name:  sort
number of ops:  4
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   10     2      > RETURN                                                       -1
   11     3*     > RETURN                                                       null

End of function sort

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
180.41 ms | 2157 KiB | 15 Q