Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Use PHP To Check For Duplicates?

Featured Replies

At the moment I have got a script that logs day, time, date etc like the following:

Friday 10th of April 2009 02:34:16 PM

Friday 10th of April 2009 02:34:21 PM

 

Is it possible to use PHP to search through this data to find duplicates?

 

E.g.

 

<?php
$DATE = ".date.";

if ($DATE>1){
echo "This has happened more than once today";
}
else
{
echo "This is the first time that this has happened today";
}
?>

 

The information is not essential so the only other way I could think of is when doing the original fwrite is to fwrite something to a file and then run a cron job every 24 hours to empty the file and then run a check to see if the file is empty or not.

Is this going to a flat text file or are you using a database?

In that case I would output each line/date to an array, then loop through the array for each stored date to find duplicates using the in_array() function.

 

EDIT:

 

Or you could even use the array_search() function...

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.