3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ZCE { public $me = 1; public function __construct($me) { $this->me = $me; } public function getProp() { return function($he) { return $this->me*$he; }; } } $a = new ZCE(2); $a->getProp = function($x) { return $x*$x; }; $m = $a->getProp(); echo $m(3);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eAOR4
function name:  (null)
number of ops:  15
compiled vars:  !0 = $a, !1 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $2      'ZCE'
          1        SEND_VAL_EX                                              2
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   17     4        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
          5        ASSIGN_OBJ                                               !0, 'getProp'
   19     6        OP_DATA                                                  ~6
   21     7        INIT_METHOD_CALL                                         !0, 'getProp'
          8        DO_FCALL                                      0  $7      
          9        ASSIGN                                                   !1, $7
   23    10        INIT_DYNAMIC_CALL                                        !1
         11        SEND_VAL_EX                                              3
         12        DO_FCALL                                      0  $9      
         13        ECHO                                                     $9
         14      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eAOR4
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        MUL                                              ~1      !0, !0
          2      > RETURN                                                   ~1
   19     3*     > RETURN                                                   null

End of Dynamic Function 0

Class ZCE:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eAOR4
function name:  __construct
number of ops:  4
compiled vars:  !0 = $me
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_OBJ                                               'me'
          2        OP_DATA                                                  !0
    7     3      > RETURN                                                   null

End of function __construct

Function getprop:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eAOR4
function name:  getProp
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   DECLARE_LAMBDA_FUNCTION                          ~0      [0]
   11     1      > RETURN                                                   ~0
   12     2*     > 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/eAOR4
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $he
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        FETCH_THIS                                       $1      
          2        FETCH_OBJ_R                                      ~2      $1, 'me'
          3        MUL                                              ~3      !0, ~2
          4      > RETURN                                                   ~3
   11     5*     > RETURN                                                   null

End of Dynamic Function 0

End of function getprop

End of class ZCE.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
132.26 ms | 1007 KiB | 13 Q