0
How to save a list in file as an array.
Eg. file contains apple, mango, banana this has to be stored as an array like $fruits = array("apple","mango","banana");
1 ответ
0
I don't know exactly about PHP, but in Python you would do:
f = open("somefile.txt","r")
file_contents = f.read()
fruits = file_contents.split(",")
The "split" method splits the string up at the given character and returns an array. You can look up what the PHP equivalent is.