show dot dot after some words php

Solutions on MaxInterview for show dot dot after some words php by the best coders in the world

showing results for - "show dot dot after some words php"
Isidora
04 Jan 2020
1The PHP way of doing this is simple:
2
3$out = strlen($in) > 50 ? substr($in,0,50)."..." : $in;
4But you can achieve a much nicer effect with this CSS:
5
6.ellipsis {
7    overflow: hidden;
8    white-space: nowrap;
9    text-overflow: ellipsis;
10}
11Now, assuming the element has a fixed width, the browser will automatically break off and add the ... for you.