williamZanelli Posted September 20, 2011 Share Posted September 20, 2011 Hi guys, I have a scalability question - I have a for loop - after which I end with a String, 150 chars long - I write this to a log file. I;m thinking, if I rather than write to log file after each iteration, would it be better to append the Sting after each iteration, and write at the end of the loop? How long could my String be, I can potentially 1000 iterations * 150 chars - is it advisable to have such a long String in memory? Thanks for your advice Link to comment https://forums.phpfreaks.com/topic/247537-php-string-length/ Share on other sites More sharing options...
RobertP Posted September 20, 2011 Share Posted September 20, 2011 append a variable, then append your log file at the end of the loop. once the script stops execution, the variables stored in the memory are dumped. Link to comment https://forums.phpfreaks.com/topic/247537-php-string-length/#findComment-1271170 Share on other sites More sharing options...
oyster12 Posted September 21, 2011 Share Posted September 21, 2011 if you write a little string to a file in a for loop, you will handle a file for 1000 or more times, I think it will take more memory than just append it to the end of iteration. Link to comment https://forums.phpfreaks.com/topic/247537-php-string-length/#findComment-1271253 Share on other sites More sharing options...
epixeltechnologies Posted September 27, 2011 Share Posted September 27, 2011 Can we take nvarchar for big string? Link to comment https://forums.phpfreaks.com/topic/247537-php-string-length/#findComment-1273133 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.