3v4l.org

run code in 300+ PHP versions simultaneously
<?php class cards { public $total = 0; public function __construct($initial = 0) { $this->total = $initial; } public function draw() { return ++$this->total; } public function getTotal() { return $this->total; } } $cards = new cards(); echo $cards->draw(); // 1 echo $cards->draw(); // 2 echo $cards->getTotal(); // 2
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lfbcL
function name:  (null)
number of ops:  13
compiled vars:  !0 = $cards
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $1      'cards'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   23     3        INIT_METHOD_CALL                                         !0, 'draw'
          4        DO_FCALL                                      0  $4      
          5        ECHO                                                     $4
   25     6        INIT_METHOD_CALL                                         !0, 'draw'
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
   27     9        INIT_METHOD_CALL                                         !0, 'getTotal'
         10        DO_FCALL                                      0  $6      
         11        ECHO                                                     $6
         12      > RETURN                                                   1

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

End of function __construct

Function draw:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lfbcL
function name:  draw
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   PRE_INC_OBJ                                      ~0      'total'
          1      > RETURN                                                   ~0
   13     2*     > RETURN                                                   null

End of function draw

Function gettotal:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lfbcL
function name:  getTotal
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_OBJ_R                                      ~0      'total'
          1      > RETURN                                                   ~0
   18     2*     > RETURN                                                   null

End of function gettotal

End of class cards.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.9 ms | 1000 KiB | 13 Q