public static $db; public function __construct() { self::$db = new Database(); }
<?php require __DIR__ . '/../vendor/autoload.php'; session_start(); // Instantiate the app $settings = require __DIR__ . '/../core/settings.php'; $app = new \Vendor\App($settings); //Vendor - your app vendor // Run app $app->run();
<?php use \Vendor\App\DataBase; ... $db = new DB(); $db->prepare('...'); $db->execute(); ...
public function extractVars() { foreach ($this->vars as $vars) { extract($vars); } }
foreach ($this->vars as $vars) { extract($vars); }