php - Limit text length and putting read more button -



php - Limit text length and putting read more button -

i want set read more button @ end of content block , limit length of content block 200 characters. code

<?php echo $row["newscontent"] ?>

how can limit $row["newscontent"] 200 characters?

you can limit length of $row['newscontent'] substr function

echo substr($row['newscontent'], 0, 199);

there various hang-ups should aware of though: take 200 characters, doesn't handle multibyte strings (utf-8 etc) , if newscontent contains markup, broken

php

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -