Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 574825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:52:23+00:00 2026-05-13T13:52:23+00:00

i wanna get some field values from database and present them on html. but

  • 0

i wanna get some field values from database and present them on html.

but some of them are longer than the div width so i wanted to chop if of and add 3 dots after them if they are longer than lets say 30 characthers.

windows vs mac os x-> windows vs m...
threads about windows vista -> threads about win...

how can i do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:52:23+00:00Added an answer on May 13, 2026 at 1:52 pm

    If you need to perform this kind of functionality more than once, consider this function:

    function truncate($string, $limit, $break = '.', $pad = '...')
    {
        // return with no change if string is shorter than $limit
        if(strlen($string) <= $limit) return $string;
    
        // is $break present between $limit and the end of the string?
        if(false !== ($breakpoint = strpos($string, $break, $limit)))
        {
            if($breakpoint < strlen($string) - 1)
            {
                $string = substr($string, 0, $breakpoint) . $pad;
            }
        }
    
        return $string;
    }
    

    Usage:

    echo truncate($string, 30);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanna get the value of some checkboxes that is in my page, but
well, i wanna pull out some data from a mysql view, but the wuery
i'm new in accessing Amazon S3 from objective C. I wanna learn some, but
I wanna to crawl pdf links. But some links that I get are double.
I wanna get all input from my pages timeline. so I read graph.facebook.com/pageid/feed with
I wanna get the width of browser window. It should contain the width of
I want to get print out invoice but also wanna set margins and page
I have a Class CButtonCreate without get & set Methode. But i wanna use
How to get the parent page values from the usercontrol. I have a usercontrol
Code in here: jsfiddle Demo I wanna to get the div#content height when it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.