How to delete an empty array in php?

by muriel.schmidt , in category: PHP General , 2 years ago

How to delete an empty array in php?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by dalton_moen , 2 years 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.

Related Threads:

How to delete an empty array in php?
How to delete an empty array in php?
How to store an empty array in redis?
How to check if an associative array is empty in powershell?
How to check if a variable is empty in PHP?
How to declare an empty variable inside function in php?