3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ColorChanger { public $lastColor; public function blackMethod() { echo "blackMethod(); Last color: {$this->lastColor}\n"; $this->lastColor = 'black'; return $this; } public function whiteMethod() { echo "whiteMethod(); Last color: {$this->lastColor}\n"; $this->lastColor = 'white'; return $this; } public function colourMethod() { echo "colourMethod(): {$this->lastColor}\n"; $this->lastColor = null; } } $c = new ColorChanger(); $c->blackMethod()->colourMethod(); $c->whiteMethod()->colourMethod(); $c->blackMethod()->whiteMethod()->colourMethod();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Pe158
function name:  (null)
number of ops:  18
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $1      'ColorChanger'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   27     3        INIT_METHOD_CALL                                         !0, 'blackMethod'
          4        DO_FCALL                                      0  $4      
          5        INIT_METHOD_CALL                                         $4, 'colourMethod'
          6        DO_FCALL                                      0          
   28     7        INIT_METHOD_CALL                                         !0, 'whiteMethod'
          8        DO_FCALL                                      0  $6      
          9        INIT_METHOD_CALL                                         $6, 'colourMethod'
         10        DO_FCALL                                      0          
   30    11        INIT_METHOD_CALL                                         !0, 'blackMethod'
         12        DO_FCALL                                      0  $8      
         13        INIT_METHOD_CALL                                         $8, 'whiteMethod'
         14        DO_FCALL                                      0  $9      
         15        INIT_METHOD_CALL                                         $9, 'colourMethod'
         16        DO_FCALL                                      0          
         17      > RETURN                                                   1

Class ColorChanger:
Function blackmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Pe158
function name:  blackMethod
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ROPE_INIT                                     3  ~2      'blackMethod%28%29%3B+Last+color%3A+'
          1        FETCH_OBJ_R                                      ~0      'lastColor'
          2        ROPE_ADD                                      1  ~2      ~2, ~0
          3        ROPE_END                                      2  ~1      ~2, '%0A'
          4        ECHO                                                     ~1
    9     5        ASSIGN_OBJ                                               'lastColor'
          6        OP_DATA                                                  'black'
   10     7        FETCH_THIS                                       ~5      
          8      > RETURN                                                   ~5
   11     9*     > RETURN                                                   null

End of function blackmethod

Function whitemethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Pe158
function name:  whiteMethod
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ROPE_INIT                                     3  ~2      'whiteMethod%28%29%3B+Last+color%3A+'
          1        FETCH_OBJ_R                                      ~0      'lastColor'
          2        ROPE_ADD                                      1  ~2      ~2, ~0
          3        ROPE_END                                      2  ~1      ~2, '%0A'
          4        ECHO                                                     ~1
   15     5        ASSIGN_OBJ                                               'lastColor'
          6        OP_DATA                                                  'white'
   16     7        FETCH_THIS                                       ~5      
          8      > RETURN                                                   ~5
   17     9*     > RETURN                                                   null

End of function whitemethod

Function colourmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Pe158
function name:  colourMethod
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ROPE_INIT                                     3  ~2      'colourMethod%28%29%3A+'
          1        FETCH_OBJ_R                                      ~0      'lastColor'
          2        ROPE_ADD                                      1  ~2      ~2, ~0
          3        ROPE_END                                      2  ~1      ~2, '%0A'
          4        ECHO                                                     ~1
   21     5        ASSIGN_OBJ                                               'lastColor'
          6        OP_DATA                                                  null
   22     7      > RETURN                                                   null

End of function colourmethod

End of class ColorChanger.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.39 ms | 1012 KiB | 13 Q