I've got this nice script with a lot of help working:
if (isset($_POST['talente'])) { // array(2) { [0]=> string(1) "2" [1]=> string(1) "3" }
$talente = $_POST['talente'];
$myFile = fopen("talente.csv", "r"); // e.f.: name;1;-;stuff
$csv = [];
while ($data = fgetcsv($myFile, 1000, ";")) {
$csv[] = $data;
}
fclose($myFile);
$i = 0;
$talentline = array_filter($csv, function($i) use ($talente) {
return in_array($i, $talente--);
}, ARRAY_FILTER_USE_KEY);
$talentline = array_filter($talentline);
$talentline = array_values($talentline);
}
$talentline[0][0] = isset($talentline[0][0]) ? $talentline[0][0] : "";
...
This works very well on my PC in localhost. But after uploading it on my host nothing happened. After printing and dumping a while I noticed, that every variable has the expected value/s but $talentline. When I set var_dump around it, it gives me a multi-dimensional array back as I expect it on PC. But on my Hoster only NULL. I couldn't find out why.
$talentean array? If not, looks like it's an integer. php.net/in_array I don't see how your code would ever work.$talente->return in_array($i, $talente--);