3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function spam(array $values) { usort($values, array($this, 'sort')); return $values; } // Protected, expected to not work. But does?! protected function sort($a, $b) { return -1; } } $a = array( 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/kHmOc
function name:  (null)
number of ops:  11
compiled vars:  !0 = $a, !1 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, <array>
   21     1        NEW                                              $3      'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $3
   22     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/kHmOc
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/kHmOc
function name:  sort
number of ops:  4
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2      > RETURN                                                   -1
   12     3*     > RETURN                                                   null

End of function sort

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.19 ms | 1396 KiB | 17 Q