array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'function.imap-rfc822-parse-adrlist.php', 1 => 'imap_rfc822_parse_adrlist', ), 'up' => array ( 0 => 'ref.imap.php', 1 => 'IMAP 関数', ), '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' => 'ja', '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 — アドレス文字列を解釈します
» RFC2822 の定義に基づき、アドレス文字列をパースします。
string
アドレスを含む文字列。
default_hostname
デフォルトのホスト名。
オブジェクトの配列を返します。オブジェクトのプロパティは以下のとおりです。
例1 imap_rfc822_parse_adrlist() の例
<?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";
}
?>
上の例の出力は以下となります。
# 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 :