Created
December 16, 2010 20:30
-
-
Save tomaskavalek/743961 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public static function init($options = NULL) { | |
if(is_null($options) || !is_array($options)) return FALSE; | |
if(is_array(current($options))) { | |
foreach($options as $option) { | |
dibi::connect($option, self::CONNECTION . self::$connection++); | |
} | |
} else { | |
dibi::connect($options, self::CONNECTION . self::$connection++); | |
} | |
} | |
$options = array( | |
array( | |
'driver' => 'mysql', | |
'host' => 'localhost', | |
'username' => 'root', | |
'password' => 'root', | |
'database' => 'test1', | |
'charset' => 'utf8', | |
), | |
array( | |
'driver' => 'mysql', | |
'host' => 'localhost', | |
'username' => 'root', | |
'password' => 'root', | |
'database' => 'test2', | |
'charset' => 'utf8', | |
), | |
); | |
..::init($options); | |
$options = array( | |
'driver' => 'mysql', | |
'host' => 'localhost', | |
'username' => 'root', | |
'password' => 'root', | |
'database' => 'test1', | |
'charset' => 'utf8', | |
); | |
..::init($options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
co použít reset() a is_array(current())?