note 21099 deleted from function.array-splice by felipe
| From: | felipe@php.net | Date: | Sat, 05 Jan 2008 02:07:25 +0000 |
| Subject: | note 21099 deleted from function.array-splice by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134810@lists.php.net to get a copy of this message | ||
Note Submitter: amtiee at hotmail dot com
----
The function my_array_splice(), accepts a user defined key of an array.
$aArray ={'Name'=>'ABC','Age'=>'22',
'Sex'=>'M'};
my_array_splice($aArray, 'Age', 1);
So now $aArray will contain only:
['Name'=>'ABC', 'Sex'=>'M']
my_array_splice() internally makes use of array_search(), which is not supported with PHP <=
4.0.4. A solution to this is to sneak into user contributed notes of function array_search(). An
alternative submitted by chen.avinadav@vbulletin.com is the solution for this problem.