3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Add { public $left; public $right; public function construct($left = 0, $right = 0) { $this->left = $left; $this->right = $right; } public function __invoke() { return $this->left + $this->right; } } $adder = new Add; $adder->left = 1; $adder->right = 2; echo $adder(); // 3 $adder->left = 3; echo $adder(); // 5
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6MKe4
function name:  (null)
number of ops:  16
compiled vars:  !0 = $adder
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $1      'Add'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   19     3        ASSIGN_OBJ                                               !0, 'left'
          4        OP_DATA                                                  1
   20     5        ASSIGN_OBJ                                               !0, 'right'
          6        OP_DATA                                                  2
   21     7        INIT_DYNAMIC_CALL                                        !0
          8        DO_FCALL                                      0  $6      
          9        ECHO                                                     $6
   23    10        ASSIGN_OBJ                                               !0, 'left'
         11        OP_DATA                                                  3
   24    12        INIT_DYNAMIC_CALL                                        !0
         13        DO_FCALL                                      0  $8      
         14        ECHO                                                     $8
         15      > RETURN                                                   1

Class Add:
Function construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6MKe4
function name:  construct
number of ops:  7
compiled vars:  !0 = $left, !1 = $right
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV_INIT                                        !0      0
          1        RECV_INIT                                        !1      0
    8     2        ASSIGN_OBJ                                               'left'
          3        OP_DATA                                                  !0
    9     4        ASSIGN_OBJ                                               'right'
          5        OP_DATA                                                  !1
   10     6      > RETURN                                                   null

End of function construct

Function __invoke:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6MKe4
function name:  __invoke
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   FETCH_OBJ_R                                      ~0      'left'
          1        FETCH_OBJ_R                                      ~1      'right'
          2        ADD                                              ~2      ~0, ~1
          3      > RETURN                                                   ~2
   14     4*     > RETURN                                                   null

End of function __invoke

End of class Add.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.51 ms | 1395 KiB | 13 Q