3v4l.org

run code in 300+ PHP versions simultaneously
$username = myusername; $password = mypw; $host = "db4free.net:3306"; $dbname = mydbname; $options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'); try { $db = new PDO("mysql:host={$host};dbname={$dbname};charset=utf8", $username, $password, $options); } catch(PDOException $ex) { die("Failed to connect to the database: " . $ex->getMessage()); } <?php
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h18ss
function name:  (null)
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%24username+%3D+myusername%3B+%0A%24password+%3D+mypw%3B+%0A%24host+%3D+%22db4free.net%3A3306%22%3B+%0A%24dbname+%3D+mydbname%3B+%0A%0A%24options+%3D+array%28PDO%3A%3AMYSQL_ATTR_INIT_COMMAND+%3D%3E+%27SET+NAMES+utf8%27%29%3B+%0A%0Atry+%0A%7B+%0A++++%24db+%3D+new+PDO%28%22mysql%3Ahost%3D%7B%24host%7D%3Bdbname%3D%7B%24dbname%7D%3Bcharset%3Dutf8%22%2C+%24username%2C+%24password%2C+%24options%29%3B+%0A%7D+%0Acatch%28PDOException+%24ex%29+%0A%7B+%0A++++die%28%22Failed+to+connect+to+the+database%3A+%22+.+%24ex-%3EgetMessage%28%29%29%3B+%0A%7D+'
   15     1      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.76 ms | 1392 KiB | 13 Q