I’ve did some research. I’ve found that you can serialize then unserialize to get a string… but I want a better solution.
I got an object array returned by IMAP pear module (function imap_getmailboxes).
public function GetMailBoxes(){
$List = imap_getmailboxes($this->Link, '{'.$this->Server.':'.$this->Port.'}', '*');
$Data = array();
if(is_array($List)){
foreach($List as $Key => $Value){
$Value = unserialize(serialize($Value));
$In = strpos($Value->name, '{');
$Out = strpos($Value->name, '}');
$Part = substr($Value, $Out);
$Value->real_name = explode($Value->delimiter, imap_utf7_decode($Part));
$Value->real_name = (isset($Value->real_name[1]) ? $Value->real_name[1] : null);
$Data[$Key] = $Value;
}
}
return $Data;
}
The problem here is strpos tell me this Warning: substr() expects parameter 1 to be string, object given in /home/david/domains/davidbelanger.net/public_html/panel/drivers/mail.php on line 178.
How Can I transform the object into a string ? Any idea, never done this before.
Thanks.
I think instead of
you want