3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Foo { public function printMyClass($viaFunction) { if ($viaFunction) { $func = function() { echo(get_called_class() . "\n"); }; $func(); } else { echo(get_called_class() . "\n"); } } } class Bar extends Foo { } Bar::printMyClass(false); Bar::printMyClass(true);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jraO6
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_STATIC_METHOD_CALL                                  'Bar', 'printMyClass'
          1        SEND_VAL                                                 <false>
          2        DO_FCALL                                      0          
   22     3        INIT_STATIC_METHOD_CALL                                  'Bar', 'printMyClass'
          4        SEND_VAL                                                 <true>
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FjraO6%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jraO6
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   GET_CALLED_CLASS                                 ~0      
          1        CONCAT                                           ~1      ~0, '%0A'
          2        ECHO                                                     ~1
    9     3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FjraO6%3A7%240

Class Foo:
Function printmyclass:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 7
Branch analysis from position: 2
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: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jraO6
function name:  printMyClass
number of ops:  11
compiled vars:  !0 = $viaFunction, !1 = $func
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    6     1      > JMPZ                                                     !0, ->7
    7     2    >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FjraO6%3A7%240'
          3        ASSIGN                                                   !1, ~2
   10     4        INIT_DYNAMIC_CALL                                        !1
          5        DO_FCALL                                      0          
          6      > JMP                                                      ->10
   12     7    >   GET_CALLED_CLASS                                 ~5      
          8        CONCAT                                           ~6      ~5, '%0A'
          9        ECHO                                                     ~6
   14    10    > > RETURN                                                   null

End of function printmyclass

End of class Foo.

Class Bar:
Function printmyclass:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 7
Branch analysis from position: 2
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: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jraO6
function name:  printMyClass
number of ops:  11
compiled vars:  !0 = $viaFunction, !1 = $func
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    6     1      > JMPZ                                                     !0, ->7
    7     2    >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FjraO6%3A7%240'
          3        ASSIGN                                                   !1, ~2
   10     4        INIT_DYNAMIC_CALL                                        !1
          5        DO_FCALL                                      0          
          6      > JMP                                                      ->10
   12     7    >   GET_CALLED_CLASS                                 ~5      
          8        CONCAT                                           ~6      ~5, '%0A'
          9        ECHO                                                     ~6
   14    10    > > RETURN                                                   null

End of function printmyclass

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.85 ms | 1390 KiB | 13 Q