Advertisement
Guest User

Untitled

a guest
May 28th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.25 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.     echo $wordlist_word;
  37.  
  38.     if ($wordlist_word == $word) {
  39.       $real = $real + $array[$i];
  40.       $i = count($array);
  41. }
  42. print $real;
  43.  
  44.  
  45. function sortword($input){
  46. echo $input;
  47. fArray = str_split($input);
  48. print_r($input);
  49. sort($fArray);
  50. unset($fArray);
  51. sort($fArray);
  52. $output = implode($fArray);
  53. return $output;
  54.  
  55. }
  56. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement