3v4l.org

run code in 300+ PHP versions simultaneously
<?php $variableGlobal = 30; class myClass{ public $classProperty; public function __construct(&$globalVar){ $this->classProperty = &$globalVar; } public function myFunction(){ $accessible = $this->classProperty; // do something interesting print "$accessible\n"; } public function accessGlobal(){ print $GLOBALS["variableGlobal"] . "\n"; } } $thisClass = new myClass($variableGlobal); $thisClass->myFunction(); $GLOBALS["variableGlobal"] = 44; $thisClass->myFunction(); $variableGlobal = 23; $thisClass->accessGlobal();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bpODA
function name:  (null)
number of ops:  16
compiled vars:  !0 = $variableGlobal, !1 = $thisClass
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 30
   25     1        NEW                                              $3      'myClass'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $3
   26     5        INIT_METHOD_CALL                                         !1, 'myFunction'
          6        DO_FCALL                                      0          
   27     7        FETCH_W                      global              $7      'GLOBALS'
          8        ASSIGN_DIM                                               $7, 'variableGlobal'
          9        OP_DATA                                                  44
   28    10        INIT_METHOD_CALL                                         !1, 'myFunction'
         11        DO_FCALL                                      0          
   29    12        ASSIGN                                                   !0, 23
   30    13        INIT_METHOD_CALL                                         !1, 'accessGlobal'
         14        DO_FCALL                                      0          
         15      > RETURN                                                   1

Class myClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bpODA
function name:  __construct
number of ops:  4
compiled vars:  !0 = $globalVar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        ASSIGN_OBJ_REF                                           'classProperty'
          2        OP_DATA                                                  !0
   10     3      > RETURN                                                   null

End of function __construct

Function myfunction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bpODA
function name:  myFunction
number of ops:  6
compiled vars:  !0 = $accessible
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   FETCH_OBJ_R                                      ~1      'classProperty'
          1        ASSIGN                                                   !0, ~1
   15     2        NOP                                                      
          3        FAST_CONCAT                                      ~3      !0, '%0A'
          4        ECHO                                                     ~3
   16     5      > RETURN                                                   null

End of function myfunction

Function accessglobal:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bpODA
function name:  accessGlobal
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_R                      global              ~0      'GLOBALS'
          1        FETCH_DIM_R                                      ~1      ~0, 'variableGlobal'
          2        CONCAT                                           ~2      ~1, '%0A'
          3        ECHO                                                     ~2
   20     4      > RETURN                                                   null

End of function accessglobal

End of class myClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.07 ms | 1390 KiB | 13 Q