After all I'm sorry for my English.
I'm writing a script in PHP and I encountered a small problem.
The idea is to create an array per line of text and replace the fourth value with a string representing the status.
I have a line of text e.g. 2022,33422,0,1,0,22
With a single line it works to create the array, but with multiple lines it creates an unexpected result.
Example:
2022,33422,0,1,0,22
2024,3232,01,1,04,298762
$myArray = explode(',', $uploadServer);
$status = array(0 => "Unprocessed",
1 => "Processing",
2 => "Download aborted because the file became too big.",
3 => "Download aborted because the file downloaded too long.",
4 => "Download finished. Uploading to RapidShare.",
5 => "Upload to RapidShare finished. Job finished.",
7 => "Upload failed 3 times for unknown reasons. Job aborted.",
8 => "Upload failed because the file is black listed.",
9 => "Download failed for unknown reasons.",
11 => "Enqueued for later processing because this account already downloads 5 files at the same time.");
foreach ($myArray as $valor) {
if(array_key_exists($valor[3],$status)) {
return $passer[] = $status[$valor[3]];
} else {
return FALSE;
}
}
The result of $myArray is
Array
(
[0] => 2022
[1] => 33422
[2] => 0
[3] => 1
[4] => 0
[5] => 22
)
But I need this final array
Array
(
[0]=>array(
[0] => 2022
[1] => 33422
[2] => 0
[3] => Processing
[4] => 0
[5] => 22
)
[1]=>array(
[0] => 2022
[1] => 33422
[2] => 0
[3] => Processing
[4] => 0
[5] => 22
)
)
Any idea? thanks