The following code will be delete the element in an array if that element is exists
in the array.
<?
$numbers = array(1,2,3,4,5);
for($i=0;$i
{
if($numbers[$i]==3)
{
unset($numbers[$i]); // removes "4"
}
}
print_r($numbers);
?>
Hope it will be useful.
No comments:
Post a Comment