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? 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. 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. Link to comment https://forums.phpfreaks.com/topic/193494-variable-not-maintaining-values/#findComment-1018693 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.