|
Posted by Chuck Anderson on 06/06/05 22:46
pauld wrote:
>tried that but doesnt seemt to clear the array values.
>
>IIRC there is soemthing that gives an array of keys
>I could then do a $arrayofkeys as $k
>{$array[$k]=0 }
>
>cant find the function though
>
>
>
Not sure why the tested versions work, but this is from the manual:
"Note: Also note that foreach operates on a copy of the specified array
and not the array itself. Therefore, the array pointer is not modified
as with the each() construct, and changes to the array element returned
are not reflected in the original array. However, the internal pointer
of the original array is advanced with the processing of the array.
Assuming the foreach loop runs to completion, the array's internal
pointer will be at the end of the array."
And a possible solution:
"As of PHP 5, you can easily modify array's elements by preceding $value
with &. This will assign reference instead of copying the value. "
--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*****************************
Navigation:
[Reply to this message]
|