3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Mailer {} class SwiftAdapter implements Mailer {} class ZendAdapter implements Mailer {} class NativeAdapter implements Mailer {} class MailerFactory { /** * Select the best available mailer * * @return Mailer */ public function select() { if (class_exists('SwiftMailer')) { // or whatever, cba looking up actual class names return $this->createSwiftAdapter(); } else if (class_exists('Zend_Mail')) { return $this->createZendAdapter(); } else { return $this->createNativeAdapter(); } } /** * Explicitly create a Swift adapter * * @return SwiftAdapter */ public function createSwiftAdapter() { return new SwiftAdapter; // can deal with args here if needed } /** * Explicitly create a Zend adapter * * @return ZendAdapter */ public function createZendAdapter() { return new ZendAdapter; // can deal with args here if needed } /** * Explicitly create a native adapter * * @return NativeAdapter */ public function createNativeAdapter() { return new NativeAdapter; // can deal with args here if needed } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fQsao
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_CLASS                                            'swiftadapter'
    6     1        DECLARE_CLASS                                            'zendadapter'
    7     2        DECLARE_CLASS                                            'nativeadapter'
   56     3      > RETURN                                                   1

Class Mailer: [no user functions]
Class SwiftAdapter: [no user functions]
Class ZendAdapter: [no user functions]
Class NativeAdapter: [no user functions]
Class MailerFactory:
Function select:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fQsao
function name:  select
number of ops:  20
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'class_exists'
          1        SEND_VAL                                                 'SwiftMailer'
          2        DO_ICALL                                         $0      
          3      > JMPZ                                                     $0, ->8
   19     4    >   INIT_METHOD_CALL                                         'createSwiftAdapter'
          5        DO_FCALL                                      0  $1      
          6      > RETURN                                                   $1
          7*       JMP                                                      ->19
   20     8    >   INIT_FCALL                                               'class_exists'
          9        SEND_VAL                                                 'Zend_Mail'
         10        DO_ICALL                                         $2      
         11      > JMPZ                                                     $2, ->16
   21    12    >   INIT_METHOD_CALL                                         'createZendAdapter'
         13        DO_FCALL                                      0  $3      
         14      > RETURN                                                   $3
         15*       JMP                                                      ->19
   23    16    >   INIT_METHOD_CALL                                         'createNativeAdapter'
         17        DO_FCALL                                      0  $4      
         18      > RETURN                                                   $4
   25    19*     > RETURN                                                   null

End of function select

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

End of function createswiftadapter

Function createzendadapter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fQsao
function name:  createZendAdapter
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   NEW                                              $0      'ZendAdapter'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   $0
   45     3*     > RETURN                                                   null

End of function createzendadapter

Function createnativeadapter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fQsao
function name:  createNativeAdapter
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   54     0  E >   NEW                                              $0      'NativeAdapter'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   $0
   55     3*     > RETURN                                                   null

End of function createnativeadapter

End of class MailerFactory.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
194.23 ms | 1405 KiB | 15 Q