php - How do I detect groups of common strings in filenames -


I am trying to find out in a way that I can locate a series of files. For example:

If the given directory contains the following files:

  • Birthday 2001.
  • Birthday 002.jpg
  • Birthday 003 .jpg
  • Picknic1.jpg
  • Picknic2.jpg
  • Afternoon Jpg.
  • I

  • afternoon (1 image)
  • / ul>

    groups me How should I go about detecting?

This is a method you can solve, which is more efficient than an animal force method .

  • Load all names in an associative array with the key equal to the name, but with the equivalent number of names (

    you have Something like that would be $ arr1 = [Birthday001 => birthday, birthday 2002 => birthday] ...

    • Now another companion with key Make an array which is the value of the first array and value that is counting when you have already seen the key. Enhance the count.
    • In the end, you will end up with a second array. Here you will find the $ arr2 = [birthday => 2, ...]

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -