3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface DoThing { public function doThing(): void; } class SimplyDoThing implements DoThing { public function doThing(): void { echo 'Thing done.' . PHP_EOL; } } class DoThingAndLog implements DoThing { public function __construct(private object $logger) {} public function doThing(): void { echo 'Thing done.' . PHP_EOL; echo 'Log logged.' . PHP_EOL; } } class DoThingAndMail implements DoThing { public function __construct(private object $mailer) {} public function doThing(): void { echo 'Thing done.' . PHP_EOL; echo 'Mail sended.' . PHP_EOL; } } (new SimplyDoThing)->doThing(); (new DoThingAndLog(new stdClass))->doThing(); (new DoThingAndMail(new stdClass))->doThing();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VseOX
function name:  (null)
number of ops:  22
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   DECLARE_CLASS                                            'simplydothing'
   13     1        DECLARE_CLASS                                            'dothingandlog'
   21     2        DECLARE_CLASS                                            'dothingandmail'
   29     3        NEW                                              $0      'SimplyDoThing'
          4        DO_FCALL                                      0          
          5        INIT_METHOD_CALL                                         $0, 'doThing'
          6        DO_FCALL                                      0          
   30     7        NEW                                              $3      'DoThingAndLog'
          8        NEW                                              $4      'stdClass'
          9        DO_FCALL                                      0          
         10        SEND_VAR_NO_REF_EX                                       $4
         11        DO_FCALL                                      0          
         12        INIT_METHOD_CALL                                         $3, 'doThing'
         13        DO_FCALL                                      0          
   31    14        NEW                                              $8      'DoThingAndMail'
         15        NEW                                              $9      'stdClass'
         16        DO_FCALL                                      0          
         17        SEND_VAR_NO_REF_EX                                       $9
         18        DO_FCALL                                      0          
         19        INIT_METHOD_CALL                                         $8, 'doThing'
         20        DO_FCALL                                      0          
         21      > RETURN                                                   1

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

End of function dothing

End of class DoThing.

Class SimplyDoThing:
Function dothing:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VseOX
function name:  doThing
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                     'Thing+done.%0A'
   10     1      > RETURN                                                   null

End of function dothing

End of class SimplyDoThing.

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

End of function __construct

Function dothing:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VseOX
function name:  doThing
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ECHO                                                     'Thing+done.%0A'
   17     1        ECHO                                                     'Log+logged.%0A'
   18     2      > RETURN                                                   null

End of function dothing

End of class DoThingAndLog.

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

End of function __construct

Function dothing:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VseOX
function name:  doThing
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   ECHO                                                     'Thing+done.%0A'
   25     1        ECHO                                                     'Mail+sended.%0A'
   26     2      > RETURN                                                   null

End of function dothing

End of class DoThingAndMail.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.6 ms | 1000 KiB | 13 Q