This question already has an answer here:
My question might seems basic but still, can't figure how to works this out.
Consider an array of my favorite fruits
$array = array("Banana","Rasberry","Blackberry")
I'm looking to clear this array so that all keys and values would be erased. My array would be empty just like if I had wrote
$array = array();
Then, I could array_push
some new data in.
I thought that I could array_walk($array, unset($array[$key])
but it's not working properly.
</div>
Your question includes the best solution for your situation:
$array = array();
This is the fastest way to make the $array
variable point to an empty array.