array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'es', ), 'this' => array ( 0 => 'function.imap-rfc822-parse-adrlist.php', 1 => 'imap_rfc822_parse_adrlist', ), 'up' => array ( 0 => 'ref.imap.php', 1 => 'IMAP Funciones', ), 'prev' => array ( 0 => 'function.imap-reopen.php', 1 => 'imap_reopen', ), 'next' => array ( 0 => 'function.imap-rfc822-parse-headers.php', 1 => 'imap_rfc822_parse_headers', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/imap/functions/imap-rfc822-parse-adrlist.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
imap_rfc822_parse_adrlist — Parses an address string
Parses the address string as defined in » RFC2822 and for each address.
string
A string containing addresses
default_hostname
The default host name
Returns an array of objects. The objects properties are:
Ejemplo #1 imap_rfc822_parse_adrlist() example
<?php
$address_string = "Joe Doe <doe@example.com>, postmaster@example.com, root";
$address_array = imap_rfc822_parse_adrlist($address_string, "example.com");
if (!is_array($address_array) || count($address_array) < 1) {
die("something is wrong\n");
}
foreach ($address_array as $id => $val) {
echo "# $id\n";
echo " mailbox : " . $val->mailbox . "\n";
echo " host : " . $val->host . "\n";
echo " personal: " . $val->personal . "\n";
echo " adl : " . $val->adl . "\n";
}
?>
El resultado del ejemplo sería:
# 0 mailbox : doe host : example.com personal: Joe Doe adl : # 1 mailbox : postmaster host : example.com personal: adl : # 2 mailbox : root host : example.com personal: adl :