How to delete an empty array in php?

by muriel.schmidt , in category: PHP General , 6 months ago

How to delete an empty array in php?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by dalton_moen , 6 months 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.