note 61398 deleted from function.imap-headerinfo by didou
| From: | didou@php.net | Date: | Sun, 14 Jan 2007 23:22:01 +0000 |
| Subject: | note 61398 deleted from function.imap-headerinfo by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-121658@lists.php.net to get a copy of this message | ||
Note Submitter: mwwaygoo AT hotmail DOT com
----
Thanks to scott AT fuzzygroup DOT com for the object thing. So to make it a bit easier in the future
I wrote a function to convert the mixed array/object to a straight array structure, as its easier to
work with.
<?php
function object_to_array($the_object)
{
$the_array=array();
if(!is_scalar($the_object))
{
foreach($the_object as $id => $object)
{
if(is_scalar($object))
{
$the_array[$id]=$object;
}
else
{
$the_array[$id]=object_to_array($object);
}
}
return $the_array;
}
else
{
return $the_object;
}
}
$array_header=object_to_array($header);
$from=$array_header['from']['0']['personal'];
$from_email=$array_header['from']['0']['mailbox'] . "@" .
$array_header['from']['0']['host'];
?>