i have this file that i want to open, a csv file, and i want to escape the 1st and 4th value for each line of data, a data record represented by $i.
when i say data record i mean each data that is split by a comma i.e.
data1, data2, data3, data4 …. etc.
this is my solution so far:
while (($data = fgetcsv($file_opener, 1000, ",")) !== FALSE) {
$num = count($data);
for ($i=0; $i < $num; $i++) {
// for each 2nd and 3rd value push to array
array_push($Ages, $data[$i]);
// if 1st and fourth value do nothing.
}
i hope this is not confusing, if you need clarification let me know, and i did check the php docs, i was trying to use the array_chunk and map methods, but i don’t know how to use them in this instance. thanks
Still not sure what you’re trying to achieve, but this script removes each 1st and 4th element from each 4-column group in a record.
prints