galvin Posted January 25, 2011 Share Posted January 25, 2011 What is the PROPER way to clear out an array? I have an array getting created as part of a loop process, and for each loop, I want the array to be emptied and start from scratch? I googled it and see some ways but the people offering the solutions don't seem too sure of themselves, so I just want to know if there is one, widely accepted and proper/efficient way to do this? Link to comment https://forums.phpfreaks.com/topic/225587-proper-way-to-clear-outflush-an-array/ Share on other sites More sharing options...
galvin Posted January 25, 2011 Author Share Posted January 25, 2011 looks like it's... unset($array); If that is not the best way, let me know. Otherwise, I'll go with it Thanks Link to comment https://forums.phpfreaks.com/topic/225587-proper-way-to-clear-outflush-an-array/#findComment-1164827 Share on other sites More sharing options...
jcbones Posted January 25, 2011 Share Posted January 25, 2011 Or, at the start of each loop, just reset the array. $array = array(); Link to comment https://forums.phpfreaks.com/topic/225587-proper-way-to-clear-outflush-an-array/#findComment-1164828 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.