如何在PHP中将数组重置为空?

Looking through the available functions in the API, I cannot find one that will start an array from empty again.

If I remember correctly:

$myarray = array();

You just set your variable to a new blank array.

$array = array();

In most cases, just assign a new array:

$ar = array();

If you really want to modify the array in-place, use array_splice:

array_splice($ar, 0, count($ar));
$myarray=array(); // Reset $myarray to an empty array.

Also, don't use unset( $array ); The execution time is way longer than = array();

Nowadays (actually, since 2012) we can use:

$array = [];

More elegant and consistent with other languages.