Reputation: 1
I load a CSV-file and post it via Jquery-Ajax to PHP. PHP should read out the array values and insert them into a query. How can I get every fifth array value, starting from value number 6, with a for-loop in PHP?
$csv = $_POST['upload']; // Array from CSV-file
foreach($csv as $row => $value)
{
foreach($value as $position => $content)
{
echo "Content of array-position $position: $content\n";
for($startposition = 6, $startposition < length($csv), $startposition += 5)
{
// get every fifth value
}
}
}
I already tried various for-loop-tutorials.
Upvotes: -2
Views: 26