0
我讀文件(answers.txt
)和寫值到一個數組添加鍵陣列
$filename = 'answers.txt';
$file = file($filename);
我如何添加鍵給數組? answers.txt
樣子:
212
150
200
212
我需要得到像鑰匙:
$array = array (
"first" => "212",
"second" => "150",
"third" => "200",
"four" => "212"
);
嘗試使用['array_combine'(HTTP:// PHP .net/manual/en/function.array-combine.php) –
文件中的數值是無限的,還是隻有四個? – someOne
重複這或許:http://stackoverflow.com/questions/6116056/php-increment-counter-function-using-words-i-e-first-second-third-etc – Rasclatt