Reply to Re: setting values in associative array to 0

Your name:

Reply:


Posted by Tony on 06/06/05 18:35

"pauld" <pdc124@yahoo.co.uk> wrote in message
news:1118071029.252822.297460@f14g2000cwb.googlegroups.com...
> reset($array);
> foreach($array as $key =>$value)
> { $array[$key] = 0;}
>
> didn't reset the array values to 0;
>
> Im stuck :-((
>

Are you trying to reset the VALUES?

Say, you have an array: ( carrots=>3, tomatoes=>5, oranges=>6, apples=>2 ) -
you want all those values set to 0 -

try this:

foreach($array as $value) {
$value = 0;
}

Then you should have ( carrots=>0, tomatoes=>0, oranges=>0, apples=>0 )

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация