note 12996 deleted from function.array-diff by irc-html
| From: | irc-html@php.net | Date: | Sat, 19 Jan 2002 20:58:50 +0000 |
| Subject: | note 12996 deleted from function.array-diff by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-25449@lists.php.net to get a copy of this message | ||
I had the problem of deleting a certain value from a non-assocciative array and did following
solution / example:
---
INTPUT:
---
$array = array ("1","2","3");
$id = "2";
$result = array_values (array_diff ($array, array($id)));
print_r ($result);
---
OUTPUT:
---
Array ( [0] => 1 [1] => 3 )
---