3v4l.org

run code in 300+ PHP versions simultaneously
<?php $config = [ 'fetchAs' => PDO::FETCH_CLASS, 'use' => 'mysql', 'drivers' => [ 'mysql' => [ 'host' => '127.0.0.1', # skip resolving localhost go directly to 127.0.0.1 ( Optional ) 'port' => 3306, # default mysql port ( Optional ) 'database' => 'twitbot', 'username' => 'root', 'password' => 'toor', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', # ( Optional ) 'persist' => true, # use persistent connection ( true | false ) 'prefix' => '', # ( Optional ) 'socket' => '', # unix socket example /tmp/mysql.sock, leave blank if you are using host ] ] ]; class Manager{ public $manager; public function __construct( array $config ) { $this->manager = new ConnectionManager( $config ); } public function getConnection() { return $this->manager->createConnection(); } } class ConnectionManager { private $config = []; private $availableDrivers = []; private $supportedDrivers = ['mysql']; public function __construct( array $config ) { $this->config = $config; $this->availableDrivers = PDO::getAvailableDrivers(); } public function createConnection() { if(empty( $this->config['use'] )) throw new Exception('Database driver must be set!', 1); # check if PDO Driver was compiled with PHP $driver = strtolower( $this->config['use'] ); if ( ! in_array( $driver, $this->availableDrivers, true )) throw new Exception('Missing PDO driver ' . $driver, 1); if ( ! in_array( $driver, $this->supportedDrivers, true )) throw new Exception($driver . ' is not supported!', 1); $reflection = new ReflectionClass(ucfirst($driver) . 'Connection'); return $reflection->newInstanceArgs([$this->config])->connect(); } } abstract class Connection { private $options = [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_CASE => PDO::CASE_NATURAL, PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, PDO::ATTR_STRINGIFY_FETCHES => false ]; public $config = []; public function __construct( array $config ) { $this->config = $config; $this->options[ PDO::ATTR_PERSISTENT ] = $this->getDriverKey('persist'); $this->options[ PDO::ATTR_DEFAULT_FETCH_MODE ] = $this->config['fetchAs']; } protected function establishConnection( $dsn = null ) { return new PDO( $dsn, $this->getDriverKey('username'), $this->getDriverKey('password'), $this->options ); } public function getDriverKey( $key = null ) { $value = $this->config['drivers'][ $this->config['use'] ][ $key ]; return ( isset($value) && ! empty($value) ) ? $value : false; } public function setOptions( array $options ) { $this->options = $options; } public function getOptions() { return $this->options; } } class MysqlConnection extends Connection{ private $dsn; public $connection; public function __construct( array $config ) { parent::__construct( $config ); $this->dsn = $this->makeDsn(); } private function makeDsn(){ return ( $this->isUsingSocket( $this->config ) ) ? $this->useSocket() : $this->useHost(); } private function isUsingSocket(){ if( empty($this->getDriverKey('socket')) && ! $this->getDriverKey('socket') ) return false; return ( is_readable($this->getDriverKey('socket')) ) ? true : false; # check if the socket file path is readable } private function isUsingPort() { return ( is_numeric($this->getDriverKey('port')) ) ? ';port=' . $this->getDriverKey('port') : ''; } private function useSocket() { return 'mysql:unix_socket=' . $this->getDriverKey('socket') . ';dbname=' . $this->getDriverKey('database') . ';charset=' . $this->getDriverKey('charset'); } private function useHost() { return 'mysql:host=' . $this->getDriverKey('host') . $this->isUsingPort() . ';dbname=' . $this->getDriverKey('database') . ';charset=' . $this->getDriverKey('charset'); } public function connect() { # check if collation is set if( $this->getDriverKey('collation') ){ #$this->options[ PDO::MYSQL_ATTR_INIT_COMMAND ] = "SET NAMES '" . $this->getDriverKey('charset') . "' COLLATE '" . $this->getDriverKey('collation') . "'"; } return $this->connection = $this->establishConnection( $this->dsn ); } } $manager = new Manager( $config ); var_dump($manager);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4uilc
function name:  (null)
number of ops:  9
compiled vars:  !0 = $config, !1 = $manager
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
  186     1        NEW                                              $3      'Manager'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $3
  188     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Class Manager:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4uilc
function name:  __construct
number of ops:  7
compiled vars:  !0 = $config
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   RECV                                             !0      
   42     1        NEW                                              $2      'ConnectionManager'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN_OBJ                                               'manager'
          5        OP_DATA                                                  $2
   43     6      > RETURN                                                   null

End of function __construct

Function getconnection:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4uilc
function name:  getConnection
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   FETCH_OBJ_R                                      ~0      'manager'
          1        INIT_METHOD_CALL                                         ~0, 'createConnection'
          2        DO_FCALL                                      0  $1      
          3      > RETURN                                                   $1
   48     4*     > RETURN                                                   null

End of function getconnection

End of class Manager.

Class ConnectionManager:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4uilc
function name:  __construct
number of ops:  8
compiled vars:  !0 = $config
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   59     0  E >   RECV                                             !0      
   61     1        ASSIGN_OBJ                                               'config'
          2        OP_DATA                                                  !0
   63     3        INIT_STATIC_METHOD_CALL                                  'PDO', 'getAvailableDrivers'
          4        DO_FCALL                                      0  $3      
          5        ASSIGN_OBJ                                               'availableDrivers'
          6        OP_DATA                                                  $3
   64     7      > RETURN                                                   null

End of function __construct

Function createconnection:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 28
Branch analysis from position: 22
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 42
Branch analysis from position: 36
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4uilc
function name:  createConnection
number of ops:  59
compiled vars:  !0 = $driver, !1 = $reflection
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   68     0  E >   FETCH_OBJ_IS                                     ~2      'config'
          1        ISSET_ISEMPTY_DIM_OBJ                         1          ~2, 'use'
          2      > JMPZ                                                     ~3, ->8
          3    >   NEW                                              $4      'Exception'
          4        SEND_VAL_EX                                              'Database+driver+must+be+set%21'
          5        SEND_VAL_EX                                              1
          6        DO_FCALL                                      0          
          7      > THROW                                         0          $4
   72     8    >   INIT_FCALL                                               'strtolower'
          9        FETCH_OBJ_R                                      ~6      'config'
         10        FETCH_DIM_R                                      ~7      ~6, 'use'
         11        SEND_VAL                                                 ~7
         12        DO_ICALL                                         $8      
         13        ASSIGN                                                   !0, $8
   74    14        INIT_FCALL                                               'in_array'
         15        SEND_VAR                                                 !0
         16        FETCH_OBJ_R                                      ~10     'availableDrivers'
         17        SEND_VAL                                                 ~10
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $11     
         20        BOOL_NOT                                         ~12     $11
         21      > JMPZ                                                     ~12, ->28
         22    >   NEW                                              $13     'Exception'
         23        CONCAT                                           ~14     'Missing+PDO+driver+', !0
         24        SEND_VAL_EX                                              ~14
         25        SEND_VAL_EX                                              1
         26        DO_FCALL                                      0          
         27      > THROW                                         0          $13
   76    28    >   INIT_FCALL                                               'in_array'
         29        SEND_VAR                                                 !0
         30        FETCH_OBJ_R                                      ~16     'supportedDrivers'
         31        SEND_VAL                                                 ~16
         32        SEND_VAL                                                 <true>
         33        DO_ICALL                                         $17     
         34        BOOL_NOT                                         ~18     $17
         35      > JMPZ                                                     ~18, ->42
         36    >   NEW                                              $19     'Exception'
         37        CONCAT                                           ~20     !0, '+is+not+supported%21'
         38        SEND_VAL_EX                                              ~20
         39        SEND_VAL_EX                                              1
         40        DO_FCALL                                      0          
         41      > THROW                                         0          $19
   78    42    >   NEW                                              $22     'ReflectionClass'
         43        INIT_FCALL                                               'ucfirst'
         44        SEND_VAR                                                 !0
         45        DO_ICALL                                         $23     
         46        CONCAT                                           ~24     $23, 'Connection'
         47        SEND_VAL_EX                                              ~24
         48        DO_FCALL                                      0          
         49        ASSIGN                                                   !1, $22
   80    50        INIT_METHOD_CALL                                         !1, 'newInstanceArgs'
         51        FETCH_OBJ_R                                      ~27     'config'
         52        INIT_ARRAY                                       ~28     ~27
         53        SEND_VAL_EX                                              ~28
         54        DO_FCALL                                      0  $29     
         55        INIT_METHOD_CALL                                         $29, 'connect'
         56        DO_FCALL                                      0  $30     
         57      > RETURN                                                   $30
   81    58*     > RETURN                                                   null

End of function createconnection

End of class ConnectionManager.

Class Connection:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4uilc
function name:  __construct
number of ops:  15
compiled vars:  !0 = $config
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  101     0  E >   RECV                                             !0      
  103     1        ASSIGN_OBJ                                               'config'
          2        OP_DATA                                                  !0
  105     3        INIT_METHOD_CALL                                         'getDriverKey'
          4        SEND_VAL_EX                                              'persist'
          5        DO_FCALL                                      0  $4      
          6        FETCH_OBJ_W                                      $2      'options'
          7        ASSIGN_DIM                                               $2, 12
          8        OP_DATA                                                  $4
  107     9        FETCH_OBJ_R                                      ~7      'config'
         10        FETCH_DIM_R                                      ~8      ~7, 'fetchAs'
         11        FETCH_OBJ_W                                      $5      'options'
         12        ASSIGN_DIM                                               $5, 19
         13        OP_DATA                                                  ~8
  108    14      > RETURN                                                   null

End of function __construct

Function establishconnection:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4uilc
function name:  establishConnection
number of ops:  17
compiled vars:  !0 = $dsn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  110     0  E >   RECV_INIT                                        !0      null
  112     1        NEW                                              $1      'PDO'
          2        SEND_VAR_EX                                              !0
          3        INIT_METHOD_CALL                                         'getDriverKey'
          4        SEND_VAL_EX                                              'username'
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR_NO_REF_EX                                       $2
          7        INIT_METHOD_CALL                                         'getDriverKey'
          8        SEND_VAL_EX                                              'password'
          9        DO_FCALL                                      0  $3      
         10        SEND_VAR_NO_REF_EX                                       $3
         11        CHECK_FUNC_ARG                                           
         12        FETCH_OBJ_FUNC_ARG                               $4      'options'
         13        SEND_FUNC_ARG                                            $4
         14        DO_FCALL                                      0          
         15      > RETURN                                                   $1
  113    16*     > RETURN                                                   null

End of function establishconnection

Function getdriverkey:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/4uilc
function name:  getDriverKey
number of ops:  19
compiled vars:  !0 = $key, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  115     0  E >   RECV_INIT                                        !0      null
  117     1        FETCH_OBJ_R                                      ~4      'config'
          2        FETCH_DIM_R                                      ~5      ~4, 'use'
          3        FETCH_OBJ_R                                      ~2      'config'
          4        FETCH_DIM_R                                      ~3      ~2, 'drivers'
          5        FETCH_DIM_R                                      ~6      ~3, ~5
          6        FETCH_DIM_R                                      ~7      ~6, !0
          7        ASSIGN                                                   !1, ~7
  119     8        ISSET_ISEMPTY_CV                                 ~9      !1
          9      > JMPZ_EX                                          ~9      ~9, ->13
         10    >   ISSET_ISEMPTY_CV                                 ~10     !1
         11        BOOL_NOT                                         ~11     ~10
         12        BOOL                                             ~9      ~11
         13    > > JMPZ                                                     ~9, ->16
         14    >   QM_ASSIGN                                        ~12     !1
         15      > JMP                                                      ->17
         16    >   QM_ASSIGN                                        ~12     <false>
         17    > > RETURN                                                   ~12
  120    18*     > RETURN                                                   null

End of function getdriverkey

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

End of function setoptions

Function getoptions:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4uilc
function name:  getOptions
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  129     0  E >   FETCH_OBJ_R                                      ~0      'options'
          1      > RETURN                                                   ~0
  130     2*     > RETURN                                                   null

End of function getoptions

End of class Connection.

Class MysqlConnection:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4uilc
function name:  __construct
number of ops:  9
compiled vars:  !0 = $config
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  139     0  E >   RECV                                             !0      
  141     1        INIT_STATIC_METHOD_CALL                                  
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
  143     4        INIT_METHOD_CALL                                         'makeDsn'
          5        DO_FCALL                                      0  $3      
          6        ASSIGN_OBJ                                               'dsn'
          7        OP_DATA                                                  $3
  144     8      > RETURN                                                   null

End of function __construct

Function makedsn:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4uilc
function name:  makeDsn
number of ops:  15
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  148     0  E >   INIT_METHOD_CALL                                         'isUsingSocket'
          1        CHECK_FUNC_ARG                                           
          2        FETCH_OBJ_FUNC_ARG                               $0      'config'
          3        SEND_FUNC_ARG                                            $0
          4        DO_FCALL                                      0  $1      
          5      > JMPZ                                                     $1, ->10
          6    >   INIT_METHOD_CALL                                         'useSocket'
          7        DO_FCALL                                      0  $2      
          8        QM_ASSIGN                                        ~3      $2
          9      > JMP                                                      ->13
         10    >   INIT_METHOD_CALL                                         'useHost'
         11        DO_FCALL                                      0  $4      
         12        QM_ASSIGN                                        ~3      $4
         13    > > RETURN                                                   ~3
  149    14*     > RETURN                                                   null

End of function makedsn

Function isusingsocket:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/4uilc
function name:  isUsingSocket
number of ops:  24
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  153     0  E >   INIT_METHOD_CALL                                         'getDriverKey'
          1        SEND_VAL_EX                                              'socket'
          2        DO_FCALL                                      0  $0      
          3        BOOL_NOT                                         ~1      $0
          4      > JMPZ_EX                                          ~1      ~1, ->10
          5    >   INIT_METHOD_CALL                                         'getDriverKey'
          6        SEND_VAL_EX                                              'socket'
          7        DO_FCALL                                      0  $2      
          8        BOOL_NOT                                         ~3      $2
          9        BOOL                                             ~1      ~3
         10    > > JMPZ                                                     ~1, ->12
         11    > > RETURN                                                   <false>
  155    12    >   INIT_FCALL                                               'is_readable'
         13        INIT_METHOD_CALL                                         'getDriverKey'
         14        SEND_VAL_EX                                              'socket'
         15        DO_FCALL                                      0  $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                         $5      
         18      > JMPZ                                                     $5, ->21
         19    >   QM_ASSIGN                                        ~6      <true>
         20      > JMP                                                      ->22
         21    >   QM_ASSIGN                                        ~6      <false>
         22    > > RETURN                                                   ~6
  156    23*     > RETURN                                                   null

End of function isusingsocket

Function isusingport:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4uilc
function name:  isUsingPort
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  160     0  E >   INIT_FCALL                                               'is_numeric'
          1        INIT_METHOD_CALL                                         'getDriverKey'
          2        SEND_VAL_EX                                              'port'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                         $1      
          6      > JMPZ                                                     $1, ->13
          7    >   INIT_METHOD_CALL                                         'getDriverKey'
          8        SEND_VAL_EX                                              'port'
          9        DO_FCALL                                      0  $2      
         10        CONCAT                                           ~3      '%3Bport%3D', $2
         11        QM_ASSIGN                                        ~4      ~3
         12      > JMP                                                      ->14
         13    >   QM_ASSIGN                                        ~4      ''
         14    > > RETURN                                                   ~4
  161    15*     > RETURN                                                   null

End of function isusingport

Function usesocket:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4uilc
function name:  useSocket
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  165     0  E >   INIT_METHOD_CALL                                         'getDriverKey'
          1        SEND_VAL_EX                                              'socket'
          2        DO_FCALL                                      0  $0      
          3        CONCAT                                           ~1      'mysql%3Aunix_socket%3D', $0
          4        CONCAT                                           ~2      ~1, '%3Bdbname%3D'
          5        INIT_METHOD_CALL                                         'getDriverKey'
          6        SEND_VAL_EX                                              'database'
          7        DO_FCALL                                      0  $3      
          8        CONCAT                                           ~4      ~2, $3
          9        CONCAT                                           ~5      ~4, '%3Bcharset%3D'
         10        INIT_METHOD_CALL                                         'getDriverKey'
         11        SEND_VAL_EX                                              'charset'
         12        DO_FCALL                                      0  $6      
         13        CONCAT                                           ~7      ~5, $6
         14      > RETURN                                                   ~7
  166    15*     > RETURN                                                   null

End of function usesocket

Function usehost:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4uilc
function name:  useHost
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  170     0  E >   INIT_METHOD_CALL                                         'getDriverKey'
          1        SEND_VAL_EX                                              'host'
          2        DO_FCALL                                      0  $0      
          3        CONCAT                                           ~1      'mysql%3Ahost%3D', $0
          4        INIT_METHOD_CALL                                         'isUsingPort'
          5        DO_FCALL                                      0  $2      
          6        CONCAT                                           ~3      ~1, $2
          7        CONCAT                                           ~4      ~3, '%3Bdbname%3D'
          8        INIT_METHOD_CALL                                         'getDriverKey'
          9        SEND_VAL_EX                                              'database'
         10        DO_FCALL                                      0  $5      
         11        CONCAT                                           ~6      ~4, $5
         12        CONCAT                                           ~7      ~6, '%3Bcharset%3D'
         13        INIT_METHOD_CALL                                         'getDriverKey'
         14        SEND_VAL_EX                                              'charset'
         15        DO_FCALL                                      0  $8      
         16        CONCAT                                           ~9      ~7, $8
         17      > RETURN                                                   ~9
  171    18*     > RETURN                                                   null

End of function usehost

Function connect:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 4
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
filename:       /in/4uilc
function name:  connect
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  177     0  E >   INIT_METHOD_CALL                                         'getDriverKey'
          1        SEND_VAL_EX                                              'collation'
          2        DO_FCALL                                      0  $0      
          3      > JMPZ                                                     $0, ->4
  182     4    >   INIT_METHOD_CALL                                         'establishConnection'
          5        CHECK_FUNC_ARG                                           
          6        FETCH_OBJ_FUNC_ARG                               $2      'dsn'
          7        SEND_FUNC_ARG                                            $2
          8        DO_FCALL                                      0  $3      
          9        ASSIGN_OBJ                                       ~1      'connection'
         10        OP_DATA                                                  $3
         11      > RETURN                                                   ~1
  183    12*     > RETURN                                                   null

End of function connect

Function establishconnection:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4uilc
function name:  establishConnection
number of ops:  17
compiled vars:  !0 = $dsn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  110     0  E >   RECV_INIT                                        !0      null
  112     1        NEW                                              $1      'PDO'
          2        SEND_VAR_EX                                              !0
          3        INIT_METHOD_CALL                                         'getDriverKey'
          4        SEND_VAL_EX                                              'username'
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR_NO_REF_EX                                       $2
          7        INIT_METHOD_CALL                                         'getDriverKey'
          8        SEND_VAL_EX                                              'password'
          9        DO_FCALL                                      0  $3      
         10        SEND_VAR_NO_REF_EX                                       $3
         11        CHECK_FUNC_ARG                                           
         12        FETCH_OBJ_FUNC_ARG                               $4      'options'
         13        SEND_FUNC_ARG                                            $4
         14        DO_FCALL                                      0          
         15      > RETURN                                                   $1
  113    16*     > RETURN                                                   null

End of function establishconnection

Function getdriverkey:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.59 ms | 1428 KiB | 25 Q