NancyJ
11-23-2007, 11:55 PM
Is there any way I can remove a key/value pair from an associative array, given the key?
|
||||
Removing a value from an associative arrayNancyJ 11-23-2007, 11:55 PM Is there any way I can remove a key/value pair from an associative array, given the key? CFMaBiSmAd 11-24-2007, 12:02 AM unset() - $arr['keep_this_1'] = 'I want 1'; $arr['remove_this'] = 'this will be gone'; $arr['keep_this_2'] = 'I want 2'; echo "<pre>"; print_r($arr); echo "</pre>"; echo "<br />"; $key = 'remove_this'; unset($arr[$key]); echo "<pre>"; print_r($arr); echo "</pre>"; |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum