Re: explode() an array and grep out a string
| From: | Adam Bregenzer | Date: | Sat, 07 Feb 2004 19:00:53 +0000 |
| Subject: | Re: explode() an array and grep out a string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-177103@lists.php.net to get a copy of this message | ||
On Sat, 2004-02-07 at 03:09, Bobby R.Cox wrote:
> Is it possible to explode an array and have it exclude a certain
> string. I currently have an array that is an ldapsearch that returns
> sub-accounts of a parent account. These accounts are then displayed so
> customer can either change the passwd or delete them. Thing is
> ldapsearch returns everymatch which includes the parent account, which
> is already listed on the page as the parent account. I would like to
> eliminate the second listing of the parent account where the
> sub-accounts are listed.
Try this:
$parent_account = 'parent_name';
$ldap_results = array('account1','account2','parent_name');
$results = array_diff($ldap_results, array($parent_account));
$results will now have only account1 and account2.
--
Adam Bregenzer
adam@bregenzer.net
http://adam.bregenzer.net/