I have a file codes.txt with records like this
USA 0233
JPN 6789
TUN 8990
CDN 2345
I want to read these content of the file to an associative array like this.
$codes["USA"] = 0233;
$codes["JPN"] = 6789;
$codes["TUN"] = 8990;
$codes["CDN"] = 2345;
this is the code that opens the file for writing. I need help in the array part. thks
$myFile = "codes.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
fclose($fh)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…