This is really simple... but I need some help.
Say I have a file with the following contents stored as abc.txt...
I want to read it into an associative array A=>A, B=>B, C=>C...
I can get it into an array like so:
<?php
$filename = 'abc.txt';
$fp = @fopen($filename, 'r');
if ($fp) {
$array = explode("\n", fread($fp, filesize($filename)));
}
?>
But how do I change this into an associative array?
Say I have a file with the following contents stored as abc.txt...
A
B
C
I want to read it into an associative array A=>A, B=>B, C=>C...
I can get it into an array like so:
<?php
$filename = 'abc.txt';
$fp = @fopen($filename, 'r');
if ($fp) {
$array = explode("\n", fread($fp, filesize($filename)));
}
?>
But how do I change this into an associative array?