Re: delete part of array

From: Date: Thu, 13 Jan 2005 05:28:15 +0000
Subject: Re: delete part of array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-206276@lists.php.net to get a copy of this message
use the unset() function. for ($i = 0; $i < count($array); $i++) { if (empty($array[$i]) { unset($array[$i]); } } On Wed, 2005-01-12 at 16:22, Sebastian wrote: > how do i delete keys from an array if it has no values? > eg, this: > > [name] => Array > ( > [0] => grape > [1] => apple > [2] => > [3] => orange > [4] => > [5] => cherry > ) > > to: > > [name] => Array > ( > [0] => grape > [1] => apple > [2] => orange > [3] => cherry > ) -- Regards, Matthew Fonda

« previous php.general (#206276) next »