drisate Posted February 12, 2009 Share Posted February 12, 2009 Hey guys i have a prob with this founction function if_decode($string,$old="utf-8",$new="utf-8",$default="iso-8859-1"){ $list = mb_list_encodings(); $type=array_map('strtolower', $list); $old=strtolower($old); $new=strtolower($new); $default=strtolower($default); $keep = ''; $temp = imap_mime_header_decode ( $string ); $i = sizeof ( $temp ); for ( $j = 0; $j < $i; $j++ ) { $temp[$j]->charset = strtolower ( $temp[$j]->charset ); if ( $temp[$j]->charset == 'default' && $old == $new || $temp[$j]->charset == $new ) { $keep .= $temp[$j]->text; } else { $keep .= mb_convert_encoding ( $temp[$j]->text, $new, ( in_array ( $temp[$j]->charset, $type ) ? $temp[$j]->charset : $default ) ); } } return $keep; } I get error Parse error: syntax error, unexpected T_VARIABLE in mail.php on line 1597 That points line $default=strtolower($default); Quote Link to comment Share on other sites More sharing options...
Q695 Posted February 12, 2009 Share Posted February 12, 2009 You need to do this in the first few lines: $string,$old="utf-8"; $new="utf-8"; $default="iso-8859-1"; function if_decode($string, $old $new, $default) Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted February 12, 2009 Share Posted February 12, 2009 The posted code by itself does not generate that error. Something in the file immediately before that code is causing the error or that code does not correspond to the line number or file that the error mentions. Post about 10 lines leading up to the code you already posted and double check the line number/file information. Quote Link to comment Share on other sites More sharing options...
drisate Posted February 12, 2009 Author Share Posted February 12, 2009 This did it thx ;-) function if_decode ( $string, $old = 'utf-8', $new = 'utf-8', $default = 'iso-8859-1' ){ $type = array_map ( 'strtolower', mb_list_encodings () ); $old = strtolower ( $old ); $new = strtolower ( $new ); $default = strtolower ( $default ); $keep = ''; $temp = imap_mime_header_decode ( $string ); $i = sizeof ( $temp ); for ( $j = 0; $j < $i; $j++ ){ $temp[$j]->charset = strtolower ( $temp[$j]->charset ); if ( $temp[$j]->charset == 'default' && $old == $new || $temp[$j]->charset == $new ){ $keep .= $temp[$j]->text; }else{ $keep .= mb_convert_encoding ( $temp[$j]->text, $new, ( in_array ( $temp[$j]->charset, $type ) ? $temp[$j]->charset : $default ) ); } return $keep; } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.