I allow a CSV to be uploaded and then I convert it into an array:
$csvAsArray = array_map('str_getcsv', file($results['full_path']));
The above code will produce something like this:
array(127) {
[0]=>
array(3) {
[0]=>
string(4) "Name"
[1]=>
string(5) "Email"
[2]=>
string(9) "Something"
}
[1]=>
array(3) {
[0]=>
string(3) "dfg"
[1]=>
string(24) "something@something.com"
[2]=>
string(2) "34"
}
[2]=>
array(3) {
[0]=>
string(3) "dfg"
[1]=>
string(23) "something@something.com"
[2]=>
string(2) "34"
}
I can't guarantee the structure of the CSV which is why I can't look up a particular column. So I can loop the array e.g.
foreach($csvAsArray as $csvData) {
var_dump($csvData);
}
How could I extract all the valid email addresses from this array?