3v4l.org

run code in 300+ PHP versions simultaneously
<?php class EchoingCounter implements Counter { private $counter; public function __construct(Counter $counter) { $this->counter = $counter; } public function count() { echo __METHOD__ . "\n"; return $this->counter->count(); } public function getCount() { echo __METHOD__ . "\n"; return $this->counter->getCount(); } } $counter = new EchoingCounter(new FluentCounter()); $counter = $counter->count()->count()->count()->count(); echo $counter->getCount();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EsnCF
function name:  (null)
number of ops:  20
compiled vars:  !0 = $counter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'echoingcounter'
   27     1        NEW                                              $1      'EchoingCounter'
          2        NEW                                              $2      'FluentCounter'
          3        DO_FCALL                                      0          
          4        SEND_VAR_NO_REF_EX                                       $2
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $1
   29     7        INIT_METHOD_CALL                                         !0, 'count'
          8        DO_FCALL                                      0  $6      
          9        INIT_METHOD_CALL                                         $6, 'count'
         10        DO_FCALL                                      0  $7      
         11        INIT_METHOD_CALL                                         $7, 'count'
         12        DO_FCALL                                      0  $8      
         13        INIT_METHOD_CALL                                         $8, 'count'
         14        DO_FCALL                                      0  $9      
         15        ASSIGN                                                   !0, $9
   31    16        INIT_METHOD_CALL                                         !0, 'getCount'
         17        DO_FCALL                                      0  $11     
         18        ECHO                                                     $11
         19      > RETURN                                                   1

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

End of function __construct

Function count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EsnCF
function name:  count
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ECHO                                                     'EchoingCounter%3A%3Acount%0A'
   16     1        FETCH_OBJ_R                                      ~0      'counter'
          2        INIT_METHOD_CALL                                         ~0, 'count'
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
   17     5*     > 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/EsnCF
function name:  getCount
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   ECHO                                                     'EchoingCounter%3A%3AgetCount%0A'
   23     1        FETCH_OBJ_R                                      ~0      'counter'
          2        INIT_METHOD_CALL                                         ~0, 'getCount'
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
   24     5*     > RETURN                                                   null

End of function getcount

End of class EchoingCounter.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.11 ms | 1399 KiB | 13 Q