Jump to content

[SOLVED] T_VARIABLE


drisate

Recommended Posts

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);

Link to comment
https://forums.phpfreaks.com/topic/144964-solved-t_variable/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/144964-solved-t_variable/#findComment-760723
Share on other sites

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;
}

}

Link to comment
https://forums.phpfreaks.com/topic/144964-solved-t_variable/#findComment-760724
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.