3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { private $prefix; public function __construct($prefix) { $this->prefix = $prefix . ' '; } public function say($x) { echo "I was told to say $prefix$x\n"; } } $foo = new foo('Hello'); function a($x) { global $foo; $foo->say($x); } function b($x) { $GLOBALS['foo']->say($x); } a("hiya"); b("howdy");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8NiGp
function name:  (null)
number of ops:  11
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $1      'foo'
          1        SEND_VAL_EX                                              'Hello'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   23     4        INIT_FCALL                                               'a'
          5        SEND_VAL                                                 'hiya'
          6        DO_FCALL                                      0          
   24     7        INIT_FCALL                                               'b'
          8        SEND_VAL                                                 'howdy'
          9        DO_FCALL                                      0          
         10      > RETURN                                                   1

Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8NiGp
function name:  a
number of ops:  6
compiled vars:  !0 = $x, !1 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        BIND_GLOBAL                                              !1, 'foo'
   16     2        INIT_METHOD_CALL                                         !1, 'say'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
   17     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/8NiGp
function name:  b
number of ops:  7
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        FETCH_R                      global              ~1      'GLOBALS'
          2        FETCH_DIM_R                                      ~2      ~1, 'foo'
          3        INIT_METHOD_CALL                                         ~2, 'say'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
   21     6      > RETURN                                                   null

End of function b

Class foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8NiGp
function name:  __construct
number of ops:  5
compiled vars:  !0 = $prefix
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        CONCAT                                           ~2      !0, '+'
          2        ASSIGN_OBJ                                               'prefix'
          3        OP_DATA                                                  ~2
    6     4      > RETURN                                                   null

End of function __construct

Function say:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8NiGp
function name:  say
number of ops:  7
compiled vars:  !0 = $x, !1 = $prefix
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ROPE_INIT                                     4  ~3      'I+was+told+to+say+'
          2        ROPE_ADD                                      1  ~3      ~3, !1
          3        ROPE_ADD                                      2  ~3      ~3, !0
          4        ROPE_END                                      3  ~2      ~3, '%0A'
          5        ECHO                                                     ~2
    9     6      > RETURN                                                   null

End of function say

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.33 ms | 1403 KiB | 15 Q