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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.