3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * A class file to connect to database */ class DB_CONNECT { // constructor function __construct() { // connecting to database $this->connect(); } // destructor function __destruct() { // closing db connection $this->close(); } /** * Function to connect with database */ function connect() { // import database connection variables require_once __DIR__ . '/db_config.php'; // Connecting to mysql database // $con = mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD) or die(mysql_error()); $db = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD,DB_DATABASE); if($db->connect_errno > 0){ die('Unable to connect to database [' . $db->connect_error . ']'); } else { echo "Connessione Avvenuta con successo"; } // Selecing database // $db = mysql_select_db(DB_DATABASE) or die(mysql_error()) or die(mysql_error()); // returing connection cursor return $db; } /** * Function to close db connection */ function close() { // closing db connection mysql_close(); } } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ti1o6
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   54     0  E > > RETURN                                                   1

Class DB_CONNECT:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ti1o6
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_METHOD_CALL                                         'connect'
          1        DO_FCALL                                      0          
   12     2      > RETURN                                                   null

End of function __construct

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ti1o6
function name:  __destruct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_METHOD_CALL                                         'close'
          1        DO_FCALL                                      0          
   18     2      > RETURN                                                   null

End of function __destruct

Function connect:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 20
Branch analysis from position: 15
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ti1o6
function name:  connect
number of ops:  23
compiled vars:  !0 = $db
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   INCLUDE_OR_EVAL                                          '%2Fin%2Fdb_config.php', REQUIRE_ONCE
   30     1        NEW                                              $2      'mysqli'
          2        FETCH_CONSTANT                                   ~3      'DB_SERVER'
          3        SEND_VAL_EX                                              ~3
          4        FETCH_CONSTANT                                   ~4      'DB_USER'
          5        SEND_VAL_EX                                              ~4
          6        FETCH_CONSTANT                                   ~5      'DB_PASSWORD'
          7        SEND_VAL_EX                                              ~5
          8        FETCH_CONSTANT                                   ~6      'DB_DATABASE'
          9        SEND_VAL_EX                                              ~6
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !0, $2
   31    12        FETCH_OBJ_R                                      ~9      !0, 'connect_errno'
         13        IS_SMALLER                                               0, ~9
         14      > JMPZ                                                     ~10, ->20
   32    15    >   FETCH_OBJ_R                                      ~11     !0, 'connect_error'
         16        CONCAT                                           ~12     'Unable+to+connect+to+database+%5B', ~11
         17        CONCAT                                           ~13     ~12, '%5D'
         18      > EXIT                                                     ~13
         19*       JMP                                                      ->21
   35    20    >   ECHO                                                     'Connessione+Avvenuta+con+successo'
   41    21      > RETURN                                                   !0
   42    22*     > RETURN                                                   null

End of function connect

Function close:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ti1o6
function name:  close
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   INIT_FCALL_BY_NAME                                       'mysql_close'
          1        DO_FCALL                                      0          
   50     2      > RETURN                                                   null

End of function close

End of class DB_CONNECT.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.97 ms | 1399 KiB | 13 Q