3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Invokable { private $callCount = 0; public function __invoke() { $this->callCount++; return $this->callCount; } } class Example { private $invokable; public function __construct() { $this->invokable = new Invokable(); } public function getInvokable0() { $invokable = $this->invokable; return $invokable(); } public function getInvokable1() { return ($this->invokable)(); } public function getInvokable2() { return $this->invokable(); } } $eg = new Example(); printf("%d\n",$eg->getInvokable0()); printf("%d\n",$eg->getInvokable1()); printf("%d\n",$eg->getInvokable2());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Eo5BT
function name:  (null)
number of ops:  22
compiled vars:  !0 = $eg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   NEW                                              $1      'Example'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   40     3        INIT_FCALL                                               'printf'
          4        SEND_VAL                                                 '%25d%0A'
          5        INIT_METHOD_CALL                                         !0, 'getInvokable0'
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
   41     9        INIT_FCALL                                               'printf'
         10        SEND_VAL                                                 '%25d%0A'
         11        INIT_METHOD_CALL                                         !0, 'getInvokable1'
         12        DO_FCALL                                      0  $6      
         13        SEND_VAR                                                 $6
         14        DO_ICALL                                                 
   42    15        INIT_FCALL                                               'printf'
         16        SEND_VAL                                                 '%25d%0A'
         17        INIT_METHOD_CALL                                         !0, 'getInvokable2'
         18        DO_FCALL                                      0  $8      
         19        SEND_VAR                                                 $8
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

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

End of function __invoke

End of class Invokable.

Class Example:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Eo5BT
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $1      'Invokable'
          1        DO_FCALL                                      0          
          2        ASSIGN_OBJ                                               'invokable'
          3        OP_DATA                                                  $1
   21     4      > RETURN                                                   null

End of function __construct

Function getinvokable0:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Eo5BT
function name:  getInvokable0
number of ops:  6
compiled vars:  !0 = $invokable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   FETCH_OBJ_R                                      ~1      'invokable'
          1        ASSIGN                                                   !0, ~1
   27     2        INIT_DYNAMIC_CALL                                        !0
          3        DO_FCALL                                      0  $3      
          4      > RETURN                                                   $3
   28     5*     > RETURN                                                   null

End of function getinvokable0

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

End of function getinvokable1

Function getinvokable2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Eo5BT
function name:  getInvokable2
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   INIT_METHOD_CALL                                         'invokable'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
   36     3*     > RETURN                                                   null

End of function getinvokable2

End of class Example.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.84 ms | 1400 KiB | 15 Q