3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function func($x) { return "Hello " . $x; } public $func; public function __construct() { $this->func = function($x) { return $x + 10; }; } } function main() { $foo = new Foo; var_dump($foo->func('World!')); var_dump(($foo->func)(1)); } main();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1602E
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'main'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F1602E%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1602E
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        ADD                                              ~1      !0, 10
          2      > RETURN                                                   ~1
   11     3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F1602E%3A9%240

Function main:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1602E
function name:  main
number of ops:  17
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   17     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'func'
          5        SEND_VAL_EX                                              'World%21'
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
   18     9        INIT_FCALL                                               'var_dump'
         10        FETCH_OBJ_R                                      ~6      !0, 'func'
         11        INIT_DYNAMIC_CALL                                        ~6
         12        SEND_VAL_EX                                              1
         13        DO_FCALL                                      0  $7      
         14        SEND_VAR                                                 $7
         15        DO_ICALL                                                 
   19    16      > RETURN                                                   null

End of function main

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

End of function func

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1602E
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F1602E%3A9%240'
          1        ASSIGN_OBJ                                               'func'
   11     2        OP_DATA                                                  ~1
   12     3      > RETURN                                                   null

End of function __construct

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.44 ms | 1403 KiB | 16 Q