|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-05-01 14:21 UTC] hara at oderwat dot de
<?php
function test() {
print("1");
flush();
}
print("0".test());
?>
RESULT: 10
I think thats wrong!
- Hans
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 01:00:01 2025 UTC |
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.) - Colinwhat you want to do is return("1") instead of print("1") in test()