3v4l.org

run code in 300+ PHP versions simultaneously
<?php class calc { private $state; public function __construct() { $this->state = 0; } public function add($number) { $this->state += $number; return $this; } public function mult($number) { $this->state = $this->state * $number; return $this; } public function echo() { echo $this->state; return $this; } } (new calc)->add(3)->add(7)->mult(3)->echo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5DnJt
function name:  (null)
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   NEW                                              $0      'calc'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $0, 'add'
          3        SEND_VAL_EX                                              3
          4        DO_FCALL                                      0  $2      
          5        INIT_METHOD_CALL                                         $2, 'add'
          6        SEND_VAL_EX                                              7
          7        DO_FCALL                                      0  $3      
          8        INIT_METHOD_CALL                                         $3, 'mult'
          9        SEND_VAL_EX                                              3
         10        DO_FCALL                                      0  $4      
         11        INIT_METHOD_CALL                                         $4, 'echo'
         12        DO_FCALL                                      0          
         13      > RETURN                                                   1

Class calc:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5DnJt
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN_OBJ                                               'state'
          1        OP_DATA                                                  0
    9     2      > RETURN                                                   null

End of function __construct

Function add:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5DnJt
function name:  add
number of ops:  6
compiled vars:  !0 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   13     1        ASSIGN_OBJ_OP                                 1          'state'
          2        OP_DATA                                                  !0
   14     3        FETCH_THIS                                       ~2      
          4      > RETURN                                                   ~2
   15     5*     > RETURN                                                   null

End of function add

Function mult:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5DnJt
function name:  mult
number of ops:  8
compiled vars:  !0 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   19     1        FETCH_OBJ_R                                      ~2      'state'
          2        MUL                                              ~3      !0, ~2
          3        ASSIGN_OBJ                                               'state'
          4        OP_DATA                                                  ~3
   20     5        FETCH_THIS                                       ~4      
          6      > RETURN                                                   ~4
   21     7*     > RETURN                                                   null

End of function mult

Function echo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5DnJt
function name:  echo
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   FETCH_OBJ_R                                      ~0      'state'
          1        ECHO                                                     ~0
   26     2        FETCH_THIS                                       ~1      
          3      > RETURN                                                   ~1
   27     4*     > RETURN                                                   null

End of function echo

End of class calc.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.15 ms | 1399 KiB | 13 Q