Jump to content

Recommended Posts

hello! i run a mybb forum and they have the worst support forum so i decided to try my luck here...

 

i have this plugin code and what i want is when the line reachers 30 characters it will go to the next line...

 

here's the code --> 

$post['custom_status_shortened'] = (strlen($post['custom_status']) > 13) ? substr($post['custom_status'],0,30): $post['custom_status'];

thanks in advance to those who can help me... :)

If you have a string containing more than 30 utf characters (you might want to be careful with character counting for special entities, such as the exponential e which's unicode representation consists of two sequences rather than one, which ultimately affects strlen), you can create a copy of the remaining string using substr, then append \n to the string (eventually \r\n for email bodies or whatever), and then concatenate the strings again.

Just an idea.

If you have a string containing more than 30 utf characters (you might want to be careful with character counting for special entities, such as the exponential e which's unicode representation consists of two sequences rather than one, which ultimately affects strlen), you can create a copy of the remaining string using substr, then append \n to the string (eventually \r\n for email bodies or whatever), and then concatenate the strings again.

Just an idea.

 

hi! thanks for the reply... that's the problem, i don't know anything about coding... i just run a forum, hopefully somebody can help me here... :)

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.