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

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:

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

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How to convert an Array to a String in PHP

By using the implode() function, we can convert all array elements into a string. This function returns the string. The separator parameter in implode() function is optional. But it is good to use two arguments.

Convert String To Array Using Javascript Split Method

In this tutorial, you’ll be going to learn how to convert string to array using javascript split method. The easiest approach to use javascript built-in method String.split(). JavaScript split string method return array of a substring after splitting a string based on the separator you provide. The separator might be a string, special character or […]

How to Generate a Unique ID in PHP (Alphanumeric String)

In php, there are many ways to generate unique alphanumeric id. First of all, we will understand why we might need unique alphanumeric id in first place.

Hire Dedicated PHP Developer

Looking to hire affordable yet experienced PHP developers? **[Hire Dedicated PHP Developer](https://hourlydeveloper.io/hire-dedicated-php-developer/ "Hire Dedicated PHP Developer")**, who can convert your idea to reality, within the stipulated...

PHP Web Application Development Company

As a top **PHP Web Application Development Company in USA**[https://www.dataeximit.com/php-development-services/](https://www.dataeximit.com/php-development-services/ "https://www.dataeximit.com/php-development-services/"), we at Data EximIT have...