Hi i would like to know how i add the ... when you cut a string in php. For example a string gets cut that exceeds the character limit and gets added with ... You can find this anywhere like on youtube or any big media site. I have searched everywhere but could not find any help. I used the substr function and would like to know if there is any way to use that to get the three dots.
nick3592
0
Light Poster
Recommended Answers
Jump to PostPerhaps the following function?
function trimstr($input,$length) { if (strlen($input)>$length) { return substr($input,$length).'...'; } else { return $input; } } echo trimstr('abcdefghijklmnopqrstuvwxyz',3);
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.