Re: Array Hell

From: Date: Thu, 23 Oct 2003 14:29:30 +0000
Subject: Re: Array Hell
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-167281@lists.php.net to get a copy of this message
* Thus wrote Richard Cook (web@nwmbrand.com): > Hi All, > Im having a headache trying to sort this out... > > If the customer inputs the value 0 into quantity the array looks like this: > > $array[0][0] = 222222 > $array[0][1] = 0 > > > The question is who can i filter the array removing any values that have 0 > in [x][1], i would also need to re-order the array from 0 to 'n'. foreach ($array as $i =>$item) { if ( $item[1]) { $new_array[] = $item; } } $array = $new_array; There might be an elegant way with one of the functions in http://php.net/array Curt -- "My PHP key is worn out" PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/

« previous php.general (#167281) next »