3v4l.org

run code in 500+ PHP versions simultaneously
<?php class MyClass { public $foo; public function __construct() { $this->foo = function(int $a, int $b): int { return $a * $b; }; } public function foo(int $a, int $b): int { return $a + $b; } } $myClass = new MyClass(); echo 'Method: ' . $myClass->foo(2, 3); echo ' Closure: ' . ($myClass->foo)(2, 3); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PXiMQ
function name:  (null)
number of ops:  17
compiled vars:  !0 = $myClass
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   20     0  E >   NEW                                                  $1      'MyClass'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   22     3        INIT_METHOD_CALL                                             !0, 'foo'
          4        SEND_VAL_EX                                                  2
          5        SEND_VAL_EX                                                  3
          6        DO_FCALL                                          0  $4      
          7        CONCAT                                               ~5      'Method%3A+', $4
          8        ECHO                                                         ~5
   23     9        FETCH_OBJ_R                                          ~6      !0, 'foo'
         10        INIT_DYNAMIC_CALL                                            ~6
         11        SEND_VAL_EX                                                  2
         12        SEND_VAL_EX                                                  3
         13        DO_FCALL                                          0  $7      
         14        CONCAT                                               ~8      '+Closure%3A+', $7
         15        ECHO                                                         ~8
   25    16      > RETURN                                                       1

Class MyClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PXiMQ
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                              ~1      [0]
          1        ASSIGN_OBJ                                                   'foo'
   11     2        OP_DATA                                                      ~1
   12     3      > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PXiMQ
function name:  {closure:MyClass::__construct():9}
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   10     2        MUL                                                  ~2      !0, !1
          3        VERIFY_RETURN_TYPE                                           ~2
          4      > RETURN                                                       ~2
   11     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of Dynamic Function 0

End of function __construct

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PXiMQ
function name:  foo
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   16     2        ADD                                                  ~2      !0, !1
          3        VERIFY_RETURN_TYPE                                           ~2
          4      > RETURN                                                       ~2
   17     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function foo

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.77 ms | 2095 KiB | 13 Q