PHP 4.2 - Win32 - command line PHP buffering output?

From: Date: Mon, 29 Apr 2002 18:49:56 +0000
Subject: PHP 4.2 - Win32 - command line PHP buffering output?
Groups: php.general 
Request: Send a blank email to php-general+get-95220@lists.php.net to get a copy of this message
Hi all, I'm trying to make the script below run, it is supposed to print a message and then wait for user input and then print another message and wait again. Instead, what it is doing is waiting for all the user input to be entered before printing anything, and once entered printing all of the messages and all of the input... I associated php-cli.exe with all .php files and have tried running it from command line with -a, -f, -q and < testscript.php ... What am I doing wrong? (I remember I once had this type of thing working back around PHP 4.04) Thanks, -Garth <? function read () { # 4092 max on win32 fopen $fp=fopen("php://stdin", "r"); $in=fgets($fp,4094); fclose($fp); # strip newline (PHP_OS == "WINNT") ? ($read = str_replace("\r\n", "", $in)) : ($read = str_replace("\n", "", $in)); return $read; } function multilineread () { do { $in = read(); # test exit if ($in == ".") return $read; # concat input (PHP_OS == "WINNT") ? ($read = $read . ($read ? "\r\n" : "") . $in) : ($read = $read . "\n" . $in); } while ($inp != "."); return $read; } print("End input with . on line by itself.\n"); print("What is your first name?\n"); $first_name = multilineread(); print("What is your last name?\n"); $last_name = read(); print("\nHello, $first_name $last_name! Nice to meet you! \n"); ?>

« previous php.general (#95220) next »