3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function dyn(&$bing) { echo $bing . "\n"; $bing++; } function sta(&$bing) { echo $bing . "\n"; $bing++; } } $a = 1; $cb = [new Foo, "inc"]; $cb($a); // Fatal error //$cb = 'Foo::sta'; //$cb($a); $cb = ['Foo', 'sta']; $cb($a); echo $a;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nH95L
function name:  (null)
number of ops:  15
compiled vars:  !0 = $a, !1 = $cb
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                   !0, 1
   18     1        NEW                                              $3      'Foo'
          2        DO_FCALL                                      0          
          3        INIT_ARRAY                                       ~5      $3
          4        ADD_ARRAY_ELEMENT                                ~5      'inc'
          5        ASSIGN                                                   !1, ~5
   19     6        INIT_DYNAMIC_CALL                                        !1
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
   25     9        ASSIGN                                                   !1, <array>
   26    10        INIT_DYNAMIC_CALL                                        !1
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0          
   28    13        ECHO                                                     !0
         14      > RETURN                                                   1

Class Foo:
Function dyn:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nH95L
function name:  dyn
number of ops:  5
compiled vars:  !0 = $bing
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        CONCAT                                           ~1      !0, '%0A'
          2        ECHO                                                     ~1
    7     3        PRE_INC                                                  !0
    8     4      > RETURN                                                   null

End of function dyn

Function sta:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nH95L
function name:  sta
number of ops:  5
compiled vars:  !0 = $bing
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        CONCAT                                           ~1      !0, '%0A'
          2        ECHO                                                     ~1
   12     3        PRE_INC                                                  !0
   13     4      > RETURN                                                   null

End of function sta

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.45 ms | 1395 KiB | 13 Q