Advertisement
matthewdeanmartin

Untitled

Feb 9th, 2016
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.41 KB | None | 0 0
  1. <?php
  2.  
  3. header("Content-type: text/html");
  4.  
  5. //$file = "a|b\nc|d\n";// file_get_contents('./urban.txt', FILE_USE_INCLUDE_PATH);
  6. $file = file_get_contents('./urban.txt', FILE_USE_INCLUDE_PATH);
  7. $pieces = explode("\n", $file);
  8. $input = $_GET['q'];
  9. $output = '';
  10. foreach ($pieces as &$value) {
  11.     $pair = explode("|", $value);
  12.     if($pair[0]==$input)
  13.     {
  14.         $output = $pair[1];
  15.     }
  16. }
  17. echo $output;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement