Re: ARRAY QUESTION

From: Date: Fri, 25 Jul 2003 04:37:10 +0000
Subject: Re: ARRAY QUESTION
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-156785@lists.php.net to get a copy of this message
* Thus wrote Dale Hersh (dalehersh@hotmail.com): > I have a question regarding the count function. Here goes: > > Lets pretend I have this array called myStuff. If I add two elements to > myStuff and call the count function, I will get a result of 2. My question > is how do I re-initialize the array after adding elements so when I call the > count function on the array, I get a result of 0. unset($myStuff); or $myStuff = array(); I usually prefer the empty array method vs. using unset for coding things like: $arr = array(); func_to_mod_array($arr); foreach($arr as $key => val) { //.... } If I used the unset function I'd have to check to see if the variable is set or not. Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#156785) next »