Tag: dump array php
[PHP]Empty an array
by Chuck Kozler on Dec.20, 2009, under Computers, Home, Programming, Web Dev
This simple function will empty an array for you. I had to use this for some stuff I was writing for parsing the results of a MySQL query.
I am surprised that there isnt a built in PHP function for this. If there is, let me know…please!
<?php function emptyArray( $array ) { $size = sizeof( $array ); for( $i = 0; $i < $size; $i++ ) { array_pop( $array ); } } ?>
I would use this so that I could use the same array over and over again in a class and have it be dumped every execution of the function it was being utilized in.
Sphere: Related Content