How to delete an empty array in php?

by muriel.schmidt , in category: PHP General , a year ago

How to delete an empty array in php?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by dalton_moen , a year ago

@muriel.schmidt 

In PHP, you can delete an empty array by using the unset() function. Here is an example:

1
2
3
4
5
$array = array(); // This is an empty array

unset($array); // Deleting the array

// The array is now deleted and no longer exists


After calling unset() on the array, it will be completely removed from memory and any references to it will become invalid.