note 27276 rejected from functions by jimw

From: Date: Sat, 30 Nov 2002 00:38:39 +0000
Subject: note 27276 rejected from functions by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-40136@lists.php.net to get a copy of this message
Hi .. I thought it was important to put the following up here : apparently, functions and while loops can become quite a mess, when you want to output paired variables to a browser PHP (maybe others too) will first execute all the function calls, before starting to run through the while loop An example : while ($statement) { $output .= "&var1=" .$var1 ; $output .= "&var2=" .the_function($var2) ; $output .= "&var3=" .$var3 ; echo $output ; } will return you the following : result_of_the_function_on_parameter &var1=var1&var2=&var3=var3 Note that the var2 in this short example is written as output before the rest of the variables - which indicates that the functions are being executed first in a while loop, and only then does the rest of the story kick in ... Would anybody be able to explain the logic of this .... ? I suppose there is a workaround that could be found, but it seems weird ... Cheers mentor

« previous php.notes (#40136) next »