Advertisement
Guest User

WP-WS-S

a guest
May 8th, 2020
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php
  2.     $partialStates = $_POST['partialState'];
  3.    
  4.     $whole = file_get_contents('/is/htdocs/xxxxxxxxxxxxx/www/main/wp-content/uploads/jb/res/songs');
  5.     $lines = explode("\n", $whole);
  6.    
  7.     $sorted = array();
  8.     $c = 0;
  9.  
  10.     foreach ($lines as $line)
  11.     {
  12.         $sim = similar_text(strtolower($partialStates), strtolower($line), $perc);
  13.        
  14.         if ($perc > 50)
  15.         {
  16.             $sorted [$c]["percent"] = $perc;
  17.             $sorted [$c]["bandsong"] = $line;
  18.             $c++;
  19.         }
  20.     }
  21.    
  22.     array_multisort( array_column($sorted, "percent"), SORT_DESC, $sorted );
  23.    
  24.     foreach ($sorted as $out)
  25.     {
  26.         echo "<div>".$out["bandsong"]."</div>";
  27.     }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement