How to make a things in a string be a part of a array

I am making a thing that involves users. All the users are stored in an array, and I want the program to read the contents of a file, which stores the stuff that is to be put into the array, like:

"user1" => "pwd", "user2 => "pwd"

in the file. Then, I use file_get_contents to get all the data into a string called $a. I put $a into the array like:

array($a);

And I want the stuff in $a to be a part of the array, not something in a array in total. How do I do that? Please help. Thanks.

My code is:

fopen("authkey.txt", "r");
$a = file_get_contents("authkey.txt");
$auth_users = array('admin' => 'something', $a);
// I want the things in $a to be a part of the array, not a string


#php #arrays #string

4 Likes1.75 GEEK