note 13404 added to function.array-pop.php
| From: | gold at NOSPAM dot babel dot com dot au | Date: | Fri, 15 Jun 2001 02:22:27 +0000 |
| Subject: | note 13404 added to function.array-pop.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14309@lists.php.net to get a copy of this message | ||
I had a situation where the LDAP function I was passing the array to died if there where empty
key/val pairs.
I was looking here thinking that I could move the key/val to the end of the array and pop it off
seeing as there wasn't any way I could find in the array_ functions of popping the pair out of
the middle.
The final solution was much simplier with hindsight so I've added it here. Hope it helps
someone.
foreach ($info as $key=>$val) {
if ($val == "") {
unset($info[$key]);
}
}
Regards,
Au.
http://www.php.net/manual/en/function.array-pop.php