All pastes #433084 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-04-10 16:25 UTC
rendered paste body
#!/usr/local/bin/php
<?php



for($i=0; $i<100; $i++)
{
		echo $i."Enter something: ";
		$stuff = input();
        echo "You entered: ".$stuff."\n";
}



function input()
{
        $fp = fopen("php://stdin", "r");
        if(!$fp)
        {
        	die("Unable to read input stream.\n");
        }
        $str = fgets($fp);
        $i=0;
        $run = true;
       /* while($run)
        {
        	$str .= $chr[$i] = fgetc($fp);
        	$i++;
        	if($chr[$i] == "\r")
        		$run = false;
        }*/
        fclose($fp);
        return pg_escape_string(trim($str));
}      
?>