+ }
+ if (isset( $extrainfo ) && $extrainfo) {
+ $result = array();
+ for ($i=0; $i<count($read); $i++) {
+ if (preg_match("/PERMANENTFLAGS(.*)/i",$read[$i], $regs)) {
+ $regs[1]=trim(preg_replace ( array ("/\(/","/\)/","/\]/") ,'', $regs[1])) ;
+ $result['PERMANENTFLAGS'] = $regs[1];
+ }
+ else if (preg_match("/FLAGS(.*)/i",$read[$i], $regs)) {
+ $regs[1]=trim(preg_replace ( array ("/\(/","/\)/") ,'', $regs[1])) ;
+ $result['FLAGS'] = $regs[1];
+ }
+ else if (preg_match("/(.*)EXISTS/i",$read[$i], $regs)) {
+ $result['EXISTS']=trim($regs[1]);
+ }
+ else if (preg_match("/(.*)RECENT/i",$read[$i], $regs)) {
+ $result['RECENT']=trim($regs[1]);
+ }
+ else if (preg_match("/\[UNSEEN(.*)\]/i",$read[$i], $regs)) {
+ $result['UNSEEN']=trim($regs[1]);
+ }
+
+ }
+ return( $result );
+ }