[eluser]pistolPete[/eluser]
[quote author="GSV Sleeper Service" date="1236093696"]If it were a single string then you could only ever make constructors that accept a single parameter. By using an array you can pass an unlimited amount of parameters.[/quote]
I disagree.
Code:
function library($library = '', $params = NULL, $object_name = NULL)
{
if ($library == '')
{
return FALSE;
}
if ( ! is_null($params) AND ! is_array($params))
{
$params = NULL;
}
If the check
! is_array($params)) wasn't there, you could easily pass everthing to a library constructor: a string, an array, an object...
Because later on, the class is instantiated using:
Code:
// $config == $params from above
$CI->$classvar = new $name($config);