3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function testMe() { $self = $this; $func = function () use ($self) { $self->callMe(); }; $func(); } private function callMe() { print "Called\n"; } } try { $a = new A(); $a->testMe(); } catch (Exception $e) { print "Getted exception: .".get_class($e).' msg: '.$e->getMessage().PHP_EOL; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 6
Branch analysis from position: 6
2 jumps found. (Code = 107) Position 1 = 7, Position 2 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9eWht
function name:  (null)
number of ops:  16
compiled vars:  !0 = $a, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $2      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   19     3        INIT_METHOD_CALL                                         !0, 'testMe'
          4        DO_FCALL                                      0          
          5      > JMP                                                      ->15
   20     6  E > > CATCH                                       last         'Exception'
   21     7    >   GET_CLASS                                        ~6      !1
          8        CONCAT                                           ~7      'Getted+exception%3A+.', ~6
          9        CONCAT                                           ~8      ~7, '+msg%3A+'
         10        INIT_METHOD_CALL                                         !1, 'getMessage'
         11        DO_FCALL                                      0  $9      
         12        CONCAT                                           ~10     ~8, $9
         13        CONCAT                                           ~11     ~10, '%0A'
         14        ECHO                                                     ~11
   22    15    > > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F9eWht%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9eWht
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $self
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   BIND_STATIC                                              !0
    7     1        INIT_METHOD_CALL                                         !0, 'callMe'
          2        DO_FCALL                                      0          
    8     3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F9eWht%3A6%240

Class A:
Function testme:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9eWht
function name:  testMe
number of ops:  8
compiled vars:  !0 = $self, !1 = $func
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FETCH_THIS                                       ~2      
          1        ASSIGN                                                   !0, ~2
    6     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F9eWht%3A6%240'
          3        BIND_LEXICAL                                             ~4, !0
          4        ASSIGN                                                   !1, ~4
    9     5        INIT_DYNAMIC_CALL                                        !1
          6        DO_FCALL                                      0          
   10     7      > RETURN                                                   null

End of function testme

Function callme:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9eWht
function name:  callMe
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ECHO                                                     'Called%0A'
   14     1      > RETURN                                                   null

End of function callme

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.23 ms | 1399 KiB | 13 Q