Mudsaf Posted June 20, 2019 Share Posted June 20, 2019 Yo, back with OOP related question. So if i have database connection with OOP style (example below) class MyDB { protected $con; private $db_host = "x"; //Database host private $db_user = "x"; //Database username private $db_pass = "x"; //Database user password private $db_name = "x"; //Database name public function connect() { $this->con = new mysqli($this->db_host, $this->db_user, $this->db_pass, $this->db_name); if ($this->con->connect_error) { die("Connection error, please try again later."); } else { return $this->con; } } } Is there way to prevent var_dump showing the database connection information if linked. (example below) $mydb = new MyDB; $con = $mydb->connect(); var_dump($con); ^Example like this, ofc I wouldn't dump the connection info itself, but if its linked in other class i think it shows it anyways when doing the var_dump. Link to comment Share on other sites More sharing options...
justsomeguy Posted June 20, 2019 Share Posted June 20, 2019 If it shows private members then I don't think there would be a way to hide those. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now