For some reason this is giving me the follow error: syntax error, unexpected T_VARIABLE
:
$mysql = json_decode(getenv("VCAP_SERVICES"));
$mysql = $mysql["mysql-5.1"][0]["credentials"];
class DATABASE_CONFIG {
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'port' => $mysql['port'], // <-- Line with error
'login' => $mysql['username'],
'password' => $mysql['password'],
'database' => $mysql['name'],
'prefix' => ''
//'encoding' => 'utf8',
);
public $test = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'user',
'password' => 'password',
'database' => 'test_database_name',
'prefix' => '',
//'encoding' => 'utf8',
);
}
I know you can use variables as values in arrays, so what is going on?