| 1 | <?php\r |
| 2 | \r |
| 3 | //READLINE\r |
| 4 | function readline($prompt="") {\r |
| 5 | echo $prompt;\r |
| 6 | \r |
| 7 | $t = "";\r |
| 8 | $c = "";\r |
| 9 | \r |
| 10 | while(1) {\r |
| 11 | $c = fread(STDIN, "1");\r |
| 12 | if ($c == "\n") { // && ($c == "\r") //May be later on oher systems\r |
| 13 | return $t;\r |
| 14 | } else {\r |
| 15 | $t = ($t.$c);\r |
| 16 | }\r |
| 17 | }\r |
| 18 | \r |
| 19 | return $t;\r |
| 20 | \r |
| 21 | }\r |
| 22 | //READLINE END\r |
| 23 | \r |
| 24 | $find = readline("Co hledat: ");\r |
| 25 | \r |
| 26 | while(1){\r |
| 27 | $pos = "";\r |
| 28 | $line = (" ".readline());\r |
| 29 | $pos = strpos($line, $find);\r |
| 30 | //echo($pos); //debug\r |
| 31 | if ($pos == "")\r |
| 32 | {} else { echo (trim($line)."\n"); }\r |
| 33 | }\r |
| 34 | \r |
| 35 | ?>\r |