Advertisement
Guest User

Untitled

a guest
May 28th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.21 KB | None | 0 0
  1. <?php
  2. ini_set('display_errors', 1);
  3. ini_set('log_errors', 1);
  4. ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
  5. error_reporting(E_ALL);
  6.  
  7. $filename = "wordlist.txt";
  8. $inputwords = "site.txt";
  9. $real = "";
  10. $break = "a";
  11.  
  12. // input
  13. //$tempchar2 = str_split($word);
  14. //sort($tempchar2);
  15. //$word = implode($tempchar2);
  16.  
  17. // Array for wordlist
  18. $words = fopen($filename, "r");
  19. $array = explode("\n", fread($words, filesize($filename)));
  20.  
  21. // Array for the words given
  22. $input = fopen($inputwords, "r");
  23. $inputarray = explode("\n", fread($input, filesize($inputwords)));
  24. //print $array["1"];  
  25.  
  26.  
  27. for ($a = 0; $a < count($inputarray); $a++) {
  28.   //print $inputarray["$a"];  
  29.   $word = sortword($inputarray[$a]);
  30.   // echo $word + " \n";
  31.  
  32.   for ($i = 0; $i < count($array); $i++) {
  33.  
  34.     // Takes in the word, breaks into array, sorts and sets a string
  35.     $wordlist_word = sortword($array[$i]);
  36.  
  37.     if ($wordlist_word == $word) {
  38.       $real = $real + $array[$i];
  39.       $i = count($array);
  40. }
  41. print $real;
  42.  
  43.  
  44. function sortword($input){
  45. $fArray = str_split($input);
  46. print_r($input);
  47. sort($fArray);
  48. unset($fArray);
  49. sort($fArray);
  50. $output = implode($fArray);
  51. return $output;
  52.  
  53. }
  54. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement