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

Delphi change the assembly code of a running process -

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

C++ 11 "class" keyword -