Hello.
I have a code bit like the one below in my code and it works fine othervice but it prints every value into the file four times. I belive this is due to the 4-dimentional nature of the array. How could I limit the amount of each string writen to the rssdata.txt file ?? :bemused:
Any help would be great ! Thank you 🙂
//We search strings that are between [Nanime] and Finnish or "(" and place them to a variable
preg_match_all("/\[Nanime\].(.*)(.Finnish|.\()/i", $title, $prosessed, PREG_SET_ORDER);
//Then we open or create RSS-DATA-file for writing
$saving = fopen("rssdata.txt", "a+") or die("Tiedostovirhe");
//Then we write the variable to the file for other purposes; \n means line change
foreach($prosessed as $key1 => $value1){
foreach($value1 as $key2 => $value2){
preg_match_all("/\[Nanime\].(.*)(.[0-9]-[0-9]|.-.[0-9][0-9])/i", $value2, $writedata, PREG_SET_ORDER);
fwrite ($saving, $writedata[0][1] . "\n");
}
}
//Then we close the file
fclose($saving);