3v4l.org

run code in 500+ PHP versions simultaneously
<?php // Current output: // TestWithPublicMethods@enter OK // TestWithPrivateMethods@enter OK // TestWithPublicMethods@leave OK // // Warning: (Registered shutdown functions) Unable to call TestWithPrivateMethods::leave() - function does not exist in Unknown on line 0 // Expected: // TestWithPublicMethods@enter OK // TestWithPrivateMethods@enter OK // TestWithPublicMethods@leave OK // TestWithPrivateMethods@leave OK class TestWithPublicMethods { public function test() { spl_autoload_register([ $this, 'enter' ], true, true); register_shutdown_function([ $this, 'leave' ]); } public function enter() { eval('class TestWithPublicMethodsAutoload {}'); echo __CLASS__ . '@' . __FUNCTION__ . " OK\n"; } public function leave() { echo __CLASS__ . '@' . __FUNCTION__ . " OK\n"; } } (new TestWithPublicMethods)->test(); new TestWithPublicMethodsAutoload; class TestWithPrivateMethods { public function test() { spl_autoload_register([ $this, 'enter' ], true, true); register_shutdown_function([ $this, 'leave' ]); } private function enter() { eval('class TestWithPrivateMethodsAutoload {}'); echo __CLASS__ . '@' . __FUNCTION__ . " OK\n"; } private function leave() { echo __CLASS__ . '@' . __FUNCTION__ . " OK\n"; } } (new TestWithPrivateMethods)->test(); new TestWithPrivateMethodsAutoload;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lClJQ
function name:  (null)
number of ops:  15
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   34     0  E >   NEW                                                  $0      'TestWithPublicMethods'
          1        DO_FCALL                                          0          
          2        INIT_METHOD_CALL                                             $0, 'test'
          3        DO_FCALL                                          0          
   35     4        NEW                                                  $3      'TestWithPublicMethodsAutoload'
          5        DO_FCALL                                          0          
          6        FREE                                                         $3
   54     7        NEW                                                  $5      'TestWithPrivateMethods'
          8        DO_FCALL                                          0          
          9        INIT_METHOD_CALL                                             $5, 'test'
         10        DO_FCALL                                          0          
   55    11        NEW                                                  $8      'TestWithPrivateMethodsAutoload'
         12        DO_FCALL                                          0          
         13        FREE                                                         $8
   56    14      > RETURN                                                       1

Class TestWithPublicMethods:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lClJQ
function name:  test
number of ops:  15
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                                   'spl_autoload_register'
          1        FETCH_THIS                                           ~0      
          2        INIT_ARRAY                                           ~1      ~0
          3        ADD_ARRAY_ELEMENT                                    ~1      'enter'
          4        SEND_VAL                                                     ~1
          5        SEND_VAL                                                     <true>
          6        SEND_VAL                                                     <true>
          7        DO_ICALL                                                     
   20     8        INIT_FCALL                                                   'register_shutdown_function'
          9        FETCH_THIS                                           ~3      
         10        INIT_ARRAY                                           ~4      ~3
         11        ADD_ARRAY_ELEMENT                                    ~4      'leave'
         12        SEND_VAL                                                     ~4
         13        DO_ICALL                                                     
   21    14      > RETURN                                                       null

End of function test

Function enter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lClJQ
function name:  enter
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   24     0  E >   INCLUDE_OR_EVAL                                              'class+TestWithPublicMethodsAutoload+%7B%7D', EVAL
   26     1        ECHO                                                         'TestWithPublicMethods%40enter+OK%0A'
   27     2      > RETURN                                                       null

End of function enter

Function leave:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lClJQ
function name:  leave
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   30     0  E >   ECHO                                                         'TestWithPublicMethods%40leave+OK%0A'
   31     1      > RETURN                                                       null

End of function leave

End of class TestWithPublicMethods.

Class TestWithPrivateMethods:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lClJQ
function name:  test
number of ops:  15
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   39     0  E >   INIT_FCALL                                                   'spl_autoload_register'
          1        FETCH_THIS                                           ~0      
          2        INIT_ARRAY                                           ~1      ~0
          3        ADD_ARRAY_ELEMENT                                    ~1      'enter'
          4        SEND_VAL                                                     ~1
          5        SEND_VAL                                                     <true>
          6        SEND_VAL                                                     <true>
          7        DO_ICALL                                                     
   40     8        INIT_FCALL                                                   'register_shutdown_function'
          9        FETCH_THIS                                           ~3      
         10        INIT_ARRAY                                           ~4      ~3
         11        ADD_ARRAY_ELEMENT                                    ~4      'leave'
         12        SEND_VAL                                                     ~4
         13        DO_ICALL                                                     
   41    14      > RETURN                                                       null

End of function test

Function enter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lClJQ
function name:  enter
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   44     0  E >   INCLUDE_OR_EVAL                                              'class+TestWithPrivateMethodsAutoload+%7B%7D', EVAL
   46     1        ECHO                                                         'TestWithPrivateMethods%40enter+OK%0A'
   47     2      > RETURN                                                       null

End of function enter

Function leave:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lClJQ
function name:  leave
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   50     0  E >   ECHO                                                         'TestWithPrivateMethods%40leave+OK%0A'
   51     1      > RETURN                                                       null

End of function leave

End of class TestWithPrivateMethods.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.3 ms | 3296 KiB | 15 Q