3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Channel { private $data; public function set($data) { $this->data = $data; } public function get() { return $this->data; } } class Foo { private $channel; public function __construct($channel) { $this->channel = $channel; } public function writeToChannel($text) { $this->channel->set($text); } } class Bar { private $channel; public function __construct($channel) { $this->channel = $channel; } public function readFromChannel() { return $this->channel->get(); } } $channel = new Channel; $aaa = new Foo($channel); $bbb = new Bar($channel); $aaa->writeToChannel('test'); var_dump($bbb->readFromChannel()); $aaa->writeToChannel('foobar'); var_dump($bbb->readFromChannel());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/burHd
function name:  (null)
number of ops:  28
compiled vars:  !0 = $channel, !1 = $aaa, !2 = $bbb
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   NEW                                              $3      'Channel'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   40     3        NEW                                              $6      'Foo'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $6
   41     7        NEW                                              $9      'Bar'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $9
   43    11        INIT_METHOD_CALL                                         !1, 'writeToChannel'
         12        SEND_VAL_EX                                              'test'
         13        DO_FCALL                                      0          
   44    14        INIT_FCALL                                               'var_dump'
         15        INIT_METHOD_CALL                                         !2, 'readFromChannel'
         16        DO_FCALL                                      0  $13     
         17        SEND_VAR                                                 $13
         18        DO_ICALL                                                 
   46    19        INIT_METHOD_CALL                                         !1, 'writeToChannel'
         20        SEND_VAL_EX                                              'foobar'
         21        DO_FCALL                                      0          
   47    22        INIT_FCALL                                               'var_dump'
         23        INIT_METHOD_CALL                                         !2, 'readFromChannel'
         24        DO_FCALL                                      0  $16     
         25        SEND_VAR                                                 $16
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

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

End of function set

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

End of function get

End of class Channel.

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/burHd
function name:  __construct
number of ops:  4
compiled vars:  !0 = $channel
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        ASSIGN_OBJ                                               'channel'
          2        OP_DATA                                                  !0
   18     3      > RETURN                                                   null

End of function __construct

Function writetochannel:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/burHd
function name:  writeToChannel
number of ops:  6
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   21     1        FETCH_OBJ_R                                      ~1      'channel'
          2        INIT_METHOD_CALL                                         ~1, 'set'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
   22     5      > RETURN                                                   null

End of function writetochannel

End of class Foo.

Class Bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/burHd
function name:  __construct
number of ops:  4
compiled vars:  !0 = $channel
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
   28     1        ASSIGN_OBJ                                               'channel'
          2        OP_DATA                                                  !0
   29     3      > RETURN                                                   null

End of function __construct

Function readfromchannel:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/burHd
function name:  readFromChannel
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   FETCH_OBJ_R                                      ~0      'channel'
          1        INIT_METHOD_CALL                                         ~0, 'get'
          2        DO_FCALL                                      0  $1      
          3      > RETURN                                                   $1
   33     4*     > RETURN                                                   null

End of function readfromchannel

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.43 ms | 1411 KiB | 15 Q