I have a google form,the data collected from it is stored in a spreadsheet, I then use PHP to get the data from the spreadsheet using the Google API.Link Of the Spreadsheet and Here is the code
<?php
$t=time();
echo($t . "<br>");
echo(date("Y-m-d",$t));
require __DIR__ . '/vendor/autoload.php';
$client = new \Google_Client();
$client->setApplicationName('Google Sheets and PHP');
$client->setScopes([\Google_Service_Sheets::SPREADSHEETS]);
$client->setAccessType('Offline');
$client->setAuthConfig(__DIR__ . '/credentials.json');
$service = new Google_Service_Sheets($client);
$spreadsheetId = "10Ta70Faby4FnbZ_bhELRRPNJ4W8m6rrhdPj5lX0ijZ8";
$range = "sfi!A2:D31";
$response = $service->spreadsheets_values->get($spreadsheetId, $range);
$values = $response->getValues();
if(empty($values)) {
print "You suck";
}
foreach($values as $row) {
$mask = "%s\n%s\n%s\n";
$mask2 = "%s\n";
$values2 = sprintf($mask,$row[1], $row[2],$row[3]);
$values3 = sprintf($mask2, $row[3]);
print($values2);
$fp = fopen($t + '.csv', 'a');//opens file in append mode
fwrite($fp, $values2);
fclose($fp);
}
?>
I want to know when 2 or more users have the same interests ie same data in row[3] how shall I do so? I tried using similar_text but it didn't work. Any help will be appreciated!