note 56486 modified in ref.array by betz

From: Date: Tue, 06 Sep 2005 09:21:01 +0000
Subject: note 56486 modified in ref.array by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-94797@lists.php.net to get a copy of this message
<?php function my_array_delete_by_key($array, $item) { if (array_key_exists($item, $array)) unset($array[$item]); return array_merge($array); } ?> This will delete elements that have null values too. --was-- A small improvement to the my_array_delete_by_key() function submitted on 2-Sep, 2005: <?php function my_array_delete_by_key($array, $item) { if (array_key_exists($item, $array)) unset($array[$item]); return array_merge($array); } ?> This will delete elements that have null values too. http://php.net/manual/en/ref.array.php

« previous php.notes (#94797) next »