I am looking for a PHP function that can read a CSV file and do vlookup in column 1 to reflect the related value in the same row in column 2.
For example, if the CSV contains:
Name,Email John, john@domain1.com Frank, frank@domain2.com Julie, julie@domain3.com
I would like to search for the name and echo value of the email.
Sort of:
<?php $name = "Name to be inserted"; $csv = 'filename.csv'; *function to vlookup $name in $csv, get column 2 value and pipe to $email* echo $email; ?>
Can anyone suggest a function that can accomplish the above?
thanks
source share