3v4l.org

run code in 300+ PHP versions simultaneously
<?php class B { private $b; private $text; public function __construct($b) { $this->b = $b; } public function getText() { return $this->text; } public function setText($text) { $this->text = $text; } } class A { private $b; public function b() { return isset($b) ? $b : new B($this); } } $a = new A; $a->b()->setText('test'); echo $a->b()->getText();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UIE1R
function name:  (null)
number of ops:  14
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   25     3        INIT_METHOD_CALL                                         !0, 'b'
          4        DO_FCALL                                      0  $4      
          5        INIT_METHOD_CALL                                         $4, 'setText'
          6        SEND_VAL_EX                                              'test'
          7        DO_FCALL                                      0          
   26     8        INIT_METHOD_CALL                                         !0, 'b'
          9        DO_FCALL                                      0  $6      
         10        INIT_METHOD_CALL                                         $6, 'getText'
         11        DO_FCALL                                      0  $7      
         12        ECHO                                                     $7
         13      > RETURN                                                   1

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

End of function __construct

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

End of function gettext

Function settext:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UIE1R
function name:  setText
number of ops:  4
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        ASSIGN_OBJ                                               'text'
          2        OP_DATA                                                  !0
   14     3      > RETURN                                                   null

End of function settext

End of class B.

Class A:
Function b:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 4
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UIE1R
function name:  b
number of ops:  11
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ISSET_ISEMPTY_CV                                         !0
          1      > JMPZ                                                     ~1, ->4
          2    >   QM_ASSIGN                                        ~2      !0
          3      > JMP                                                      ->9
          4    >   NEW                                              $3      'B'
          5        FETCH_THIS                                       $4      
          6        SEND_VAR_EX                                              $4
          7        DO_FCALL                                      0          
          8        QM_ASSIGN                                        ~2      $3
          9    > > RETURN                                                   ~2
   21    10*     > RETURN                                                   null

End of function b

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.67 ms | 1399 KiB | 13 Q