Bug #10584 Updated: flush() in functions - behaviour wrong?

From: Date: Tue, 01 May 2001 18:52:11 +0000
Subject: Bug #10584 Updated: flush() in functions - behaviour wrong?
Groups: php.dev 
Request: Send a blank email to php-dev+get-53223@lists.php.net to get a copy of this message
ID: 10584 Updated by: hholzgra Reported By: hara@oderwat.de Old-Status: Open Status: Closed Bug Type: Scripting Engine problem PHP Version: 4.0.5 Assigned To: Comments: what you want to do is return("1") instead of print("1") in test() Previous Comments: --------------------------------------------------------------------------- [2001-05-01 14:46:54] cmv@php.net Well, I would say it's counter-intuitive perhaps, but not wrong. :) Think of it like a math expression, with parenthesis defining precedence: evaluated first vvvv print( "0" . test() ); ^ ^ evaluated second So the test() gets evaluated first which does it's flush(), then the rest. (Besides, test() doesn't return anything, so printing it's result is probably wrong anyway.) - Colin --------------------------------------------------------------------------- [2001-05-01 14:21:04] hara@oderwat.de <?php function test() { print("1"); flush(); } print("0".test()); ?> RESULT: 10 I think thats wrong! - Hans --------------------------------------------------------------------------- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=10584&edit=2

« previous php.dev (#53223) next »