3v4l.org

run code in 300+ PHP versions simultaneously
<?php class consumption { public $total; public $now; public $unit; } function show() { $econsumption = new consumption(); $econsumption->total = 100; $econsumption->now = 0.20; $econsumption->unit = 'KWh'; return $econsumption; } $test = new consumption(); $test = show(); echo $test->total; echo $test->now; echo $test->unit; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XMoT0
function name:  (null)
number of ops:  13
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $1      'consumption'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   17     3        INIT_FCALL                                               'show'
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !0, $4
   18     6        FETCH_OBJ_R                                      ~6      !0, 'total'
          7        ECHO                                                     ~6
   19     8        FETCH_OBJ_R                                      ~7      !0, 'now'
          9        ECHO                                                     ~7
   20    10        FETCH_OBJ_R                                      ~8      !0, 'unit'
         11        ECHO                                                     ~8
   22    12      > RETURN                                                   1

Function show:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XMoT0
function name:  show
number of ops:  11
compiled vars:  !0 = $econsumption
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $1      'consumption'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   10     3        ASSIGN_OBJ                                               !0, 'total'
          4        OP_DATA                                                  100
   11     5        ASSIGN_OBJ                                               !0, 'now'
          6        OP_DATA                                                  0.2
   12     7        ASSIGN_OBJ                                               !0, 'unit'
          8        OP_DATA                                                  'KWh'
   13     9      > RETURN                                                   !0
   14    10*     > RETURN                                                   null

End of function show

Class consumption: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.07 ms | 1398 KiB | 14 Q