Can someone help me how to change value of an array to variable?
I would like to change from this:
class SimpleAuth
{
var $users = array(
'admin1' => 'password1', //
'admin2' => 'password2', // User 2
'admin3' => 'password3', // User 3
'admin4' => 'password4', // User 4
);
}
to:
$user = 'admin'; // value from an include file outside the class declaration
$password = 'password'; // value from an include file outside the class declaration
class SimpleAuth
{
var $users = array(
$user => $password, // User 1 // here is the error
'admin2' => 'password2', // User 2
'admin3' => 'password3', // User 3
'admin4' => 'password4', // User 4
);
}
I get 500 error. Please help! Thanks