3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { var $myarray; function add($x) { $this->myarray[] = $x; } } $foo = new foo(); function a($x) { global $foo; $foo->add($x); } function b($x) { $GLOBALS['foo']->add($x); } a("hiya"); b("howdy"); print_r($foo->myarray);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hrPuN
function name:  (null)
number of ops:  14
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $1      'foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   21     3        INIT_FCALL                                               'a'
          4        SEND_VAL                                                 'hiya'
          5        DO_FCALL                                      0          
   22     6        INIT_FCALL                                               'b'
          7        SEND_VAL                                                 'howdy'
          8        DO_FCALL                                      0          
   24     9        INIT_FCALL                                               'print_r'
         10        FETCH_OBJ_R                                      ~6      !0, 'myarray'
         11        SEND_VAL                                                 ~6
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hrPuN
function name:  a
number of ops:  6
compiled vars:  !0 = $x, !1 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        BIND_GLOBAL                                              !1, 'foo'
   14     2        INIT_METHOD_CALL                                         !1, 'add'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
   15     5      > RETURN                                                   null

End of function a

Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hrPuN
function name:  b
number of ops:  7
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        FETCH_R                      global              ~1      'GLOBALS'
          2        FETCH_DIM_R                                      ~2      ~1, 'foo'
          3        INIT_METHOD_CALL                                         ~2, 'add'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
   19     6      > RETURN                                                   null

End of function b

Class foo:
Function add:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hrPuN
function name:  add
number of ops:  5
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        FETCH_OBJ_W                                      $1      'myarray'
          2        ASSIGN_DIM                                               $1
          3        OP_DATA                                                  !0
    7     4      > RETURN                                                   null

End of function add

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.98 ms | 1402 KiB | 17 Q