Re: setting values in associative array to 0
Ewoud Dronkert wrote:[color=blue]
> On 6 Jun 2005 06:49:37 -0700, pauld wrote:[color=green]
> > help please ?[/color]
>
> Tested and working:
>
> $a = array( 'one' => 1, 'two' => 2, 'three' => 3 );
>
> // solution 1
> $b = $a;
> foreach ( $b as $k => $v ) $b[$k] = 0;[/color]
<snip>
IIRC, this is highly discouraged solution. Better use each().
--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com
Ewoud Dronkert wrote:[color=blue]
> On 6 Jun 2005 06:49:37 -0700, pauld wrote:[color=green]
> > help please ?[/color]
>
> Tested and working:
>
> $a = array( 'one' => 1, 'two' => 2, 'three' => 3 );
>
> // solution 1
> $b = $a;
> foreach ( $b as $k => $v ) $b[$k] = 0;[/color]
<snip>
IIRC, this is highly discouraged solution. Better use each().
--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com
Comment