Dimensional Posted February 26, 2010 Share Posted February 26, 2010 What server/php setting difference would cause a variable to be overwritten in a loop? Local server = fine. Live server = variable not maintaining values added in previous loops. foreach($arr as $b){ while($x<$y){ $var[] = "value"; } } On the live server $var will only contain the values of the final loop. On the local it will have values from every loop. I'm guessing something might be limiting its scope, but what? Quote Link to comment https://forums.phpfreaks.com/topic/193494-variable-not-maintaining-values/ Share on other sites More sharing options...
Dimensional Posted February 26, 2010 Author Share Posted February 26, 2010 Sorry wrong forum. Can't seem to move or delete it though. Quote Link to comment https://forums.phpfreaks.com/topic/193494-variable-not-maintaining-values/#findComment-1018651 Share on other sites More sharing options...
PFMaBiSmAd Posted February 26, 2010 Share Posted February 26, 2010 Since that is not actual working code, nor does it contain a sample of the data and what results you are actually getting, it is impossible to tell you what could be causing the symptom. Some guesses - 1) register_globals are on, 2) you only have one value, so all you get is that one/last value in the results. Quote Link to comment https://forums.phpfreaks.com/topic/193494-variable-not-maintaining-values/#findComment-1018693 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.