Jump to content

clear an array


pluginbaby

Recommended Posts

$blabla is an array, like:

$blabla[0]=haha
$blabla[1]=hihi
...

now, is there a function wich I can use to clear the whole array in one time?

so when I use the function, $blabla[0] is empty and also $blabla[1] and so on, in stead of clearing them one by one like: $blabla[0]=""; $blabla[1]=""; ...

is this possible or not?
Link to comment
https://forums.phpfreaks.com/topic/20982-clear-an-array/
Share on other sites

Use unset or redifine $blablah to have a null value

[code=php:0]// unset deletes the variabl $blahBlah
unset($blablah);

// or redifine blabla with a null value, so its not an array anymore
$blablah = '';[/code]

Or do what ken says above, redifine blabla as an empty array.
Link to comment
https://forums.phpfreaks.com/topic/20982-clear-an-array/#findComment-93065
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.