3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Something { public function action() { return 'Hello, World!'; } } $callable1 = [Something::class, 'action']; $callable1 = ['SomethingContainerName', 'action']; $callable2 = 'Something::action'; var_dump(is_callable($callable1)); var_dump(is_callable($callable2)); function test(callable $callable) { return is_callable($callable); } var_dump(test($callable1)); var_dump(test($callable2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7HC7m
function name:  (null)
number of ops:  28
compiled vars:  !0 = $callable1, !1 = $callable2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   12     1        ASSIGN                                                   !0, <array>
   13     2        ASSIGN                                                   !1, 'Something%3A%3Aaction'
   15     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL                                               'is_callable'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $5      
          7        SEND_VAR                                                 $5
          8        DO_ICALL                                                 
   16     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'is_callable'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $7      
         13        SEND_VAR                                                 $7
         14        DO_ICALL                                                 
   22    15        INIT_FCALL                                               'var_dump'
         16        INIT_FCALL                                               'test'
         17        SEND_VAR                                                 !0
         18        DO_FCALL                                      0  $9      
         19        SEND_VAR                                                 $9
         20        DO_ICALL                                                 
   23    21        INIT_FCALL                                               'var_dump'
         22        INIT_FCALL                                               'test'
         23        SEND_VAR                                                 !1
         24        DO_FCALL                                      0  $11     
         25        SEND_VAR                                                 $11
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7HC7m
function name:  test
number of ops:  6
compiled vars:  !0 = $callable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   19     1        INIT_FCALL                                               'is_callable'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   20     5*     > RETURN                                                   null

End of function test

Class Something:
Function action:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7HC7m
function name:  action
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E > > RETURN                                                   'Hello%2C+World%21'
    8     1*     > RETURN                                                   null

End of function action

End of class Something.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147 ms | 1406 KiB | 20 Q