3v4l.org

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

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JQks2
function name:  test
number of ops:  6
compiled vars:  !0 = $callable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        INIT_FCALL                                               'is_callable'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   21     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/JQks2
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:
177.71 ms | 1403 KiB | 20 Q