Empties the array’s contents, freeing all memory reserved for the array. After you clear an array, its size is 0. When you no longer need to use an array, use the clear function to free memory.
array is the name of the array you want to clear.
The clear function returns 1 if the function succeeds, 0 if it fails. The return value is not typically used in expressions.
int $myInts[] = {1,2,3,4,5,6}; print("size of $myInts is: "+size($myInts)+"\n"); clear($myInts); print("size of $myInts is: "+size($myInts)+"\n");
The third statement above clears the array $myInts.
The second and fourth statements display the following text in the Script Editor:
size of $myInts is: 6 size of $myInts is: 0
Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License