Re: removing an array element

From: Date: Fri, 11 Jan 2002 17:31:00 +0000
Subject: Re: removing an array element
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-80216@lists.php.net to get a copy of this message
> what function is used to remove an array element from an array? Like > array_pop(), except one by which I can refer to the element by its > associative index rather than just the last element of the array. unset($array['index']); > echo "<select name=\"home_div_id\">\n"; > echo "<option value=\"$home_div_id\" > selected=\"yes\">$div_name</option>\n"; > while ($temprow = mysql_fetch_array($tempresult)) { > echo "<option value=\"" . $temprow['div_id'] > . "\">" . $temprow['div_name'] . > "</option>\n"; > } > echo "</select>\n"; Why not just add a simple check inside that while loop? if($temprow['div_id'] != $home_div_id) echo "<option value=\"" . $temprow['div_id'] . "\">" . $temprow['div_name'] . "</option>\n"; Seems more logical to me than to mess with the array itself. -Rasmus

« previous php.general (#80216) next »