3v4l.org

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

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

End of function sta

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.89 ms | 1399 KiB | 13 Q