How use array in text file text file (PHP)? -
I have a txt file that has an array like this:
Array (0 = & gt; 'jack', 1 = & gt; 'alex')
I want to use this array in my PHP code but it does not work on this example Is a
$ list = file_get_contents (myfile.txt); Echoes $ list [0];
How do I convert it?
Rather array serialize
d or json_encode
d After that, when reading this, within that file, only unserialize
or json_decode
in $ list
example: < / P>
$ list = unserialize (file_get_contents (myfile.txt));
Comments
Post a Comment