3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Bug1971; class HelloWorld { public function sayHello(): void { echo 'Hello'; } public function getClosure(): void { $closure1 = \Closure::fromCallable([self::class, 'sayHello']); $closure1(); $closure2 = \Closure::fromCallable([static::class, 'sayHello']); $closure2(); //$closure2 = \Closure::fromCallable([static::class, 'sayHello2']); //$closure2(); } } $hw = new HelloWorld(); $hw->getClosure();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mTa9S
function name:  (null)
number of ops:  6
compiled vars:  !0 = $hw
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'Bug1971%5CHelloWorld'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   24     3        INIT_METHOD_CALL                                         !0, 'getClosure'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class Bug1971\HelloWorld:
Function sayhello:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mTa9S
function name:  sayHello
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                     'Hello'
   10     1      > RETURN                                                   null

End of function sayhello

Function getclosure:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mTa9S
function name:  getClosure
number of ops:  16
compiled vars:  !0 = $closure1, !1 = $closure2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_STATIC_METHOD_CALL                                  'Closure', 'fromCallable'
          1        SEND_VAL                                                 <array>
          2        DO_FCALL                                      0  $2      
          3        ASSIGN                                                   !0, $2
   15     4        INIT_DYNAMIC_CALL                                        !0
          5        DO_FCALL                                      0          
   16     6        INIT_STATIC_METHOD_CALL                                  'Closure', 'fromCallable'
          7        FETCH_CLASS_NAME                                 ~5      
          8        INIT_ARRAY                                       ~6      ~5
          9        ADD_ARRAY_ELEMENT                                ~6      'sayHello'
         10        SEND_VAL                                                 ~6
         11        DO_FCALL                                      0  $7      
         12        ASSIGN                                                   !1, $7
   17    13        INIT_DYNAMIC_CALL                                        !1
         14        DO_FCALL                                      0          
   20    15      > RETURN                                                   null

End of function getclosure

End of class Bug1971\HelloWorld.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.13 ms | 1000 KiB | 13 Q