0

How can I access database, host, password and username values if they are embedded in an array of another file? In Sample.php I'm trying to reuse the mentioned values from Configuration.php. How to do so? Unfortunately I can't change Configuration.php.

Configuration.php

<?php
return [
    ...
    'DB' => [
        'database' => 'mydatabase',
        'host' => 'myhost',
        'password' => 'mypassword',
        'port' => '',
        'username' => 'myusername',
    ],
    ...
];

Sample.php

<?php

require('../Configuration.php');

$mysqli = new MySQLi($server,$user,$password,$database);

...
Philipp M
  • 3,306
  • 5
  • 36
  • 90

0 Answers0