mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Cleaned up example. Switched it to using foreach instead of while/list/each.
Also added extra sanity check as suggested in the notes (count($address_array) < 1). git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@143606 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
a49efe3b09
commit
91cf805ecf
1 changed files with 3 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.4 $ -->
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- splitted from ./en/functions/imap.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.imap-rfc822-parse-adrlist">
|
||||
<refnamediv>
|
||||
|
@ -51,10 +51,9 @@
|
|||
<?php
|
||||
$address_string = "Hartmut Holzgraefe <hartmut@cvs.php.net>, postmaster@somedomain.net, root";
|
||||
$address_array = imap_rfc822_parse_adrlist($address_string,"somedomain.net");
|
||||
if(! is_array($address_array)) die("somethings wrong\n");
|
||||
if(!is_array($address_array) || count($address_array) < 1) die("something is wrong\n");
|
||||
|
||||
reset($address_array);
|
||||
while(list($key,$val)=each($address_array)){
|
||||
foreach($address_array as $val) {
|
||||
print "mailbox : ".$val->mailbox."<br>\n";
|
||||
print "host : ".$val->host."<br>\n";
|
||||
print "personal: ".$val->personal."<br>\n";
|
||||
|
|
Loading…
Reference in a new issue