3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Counter { /** @return self */ public function count(); /** @return int */ public function getCount(); } class FluentCounter implements Counter { private $count = 0; public function count() { $this->count += 1; return $this; } public function getCount() { return $this->count; } } $counter = new FluentCounter(); $counter = $counter->count()->count()->count(); echo $counter->getCount();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fILUc
function name:  (null)
number of ops:  15
compiled vars:  !0 = $counter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   DECLARE_CLASS                                            'fluentcounter'
   28     1        NEW                                              $1      'FluentCounter'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   30     4        INIT_METHOD_CALL                                         !0, 'count'
          5        DO_FCALL                                      0  $4      
          6        INIT_METHOD_CALL                                         $4, 'count'
          7        DO_FCALL                                      0  $5      
          8        INIT_METHOD_CALL                                         $5, 'count'
          9        DO_FCALL                                      0  $6      
         10        ASSIGN                                                   !0, $6
   32    11        INIT_METHOD_CALL                                         !0, 'getCount'
         12        DO_FCALL                                      0  $8      
         13        ECHO                                                     $8
         14      > RETURN                                                   1

Class Counter:
Function count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fILUc
function name:  count
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   null

End of function count

Function getcount:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fILUc
function name:  getCount
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E > > RETURN                                                   null

End of function getcount

End of class Counter.

Class FluentCounter:
Function count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fILUc
function name:  count
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ASSIGN_OBJ_OP                                 1          'count'
          1        OP_DATA                                                  1
   19     2        FETCH_THIS                                       ~1      
          3      > RETURN                                                   ~1
   20     4*     > RETURN                                                   null

End of function count

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

End of function getcount

End of class FluentCounter.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.3 ms | 1439 KiB | 13 Q