PHP how to limit lines in a string ?

Posted by Axel on Stack Overflow See other posts from Stack Overflow or by Axel
Published on 2010-03-15T18:45:57Z Indexed on 2010/03/15 18:49 UTC
Read the original article Hit count: 198

Filed under:

Hi, i have a variable like the following and i want a function to only keep the first 20 lines, so it will strips any additional \n lines more than 20.

<?php
$mytext="Line1
Line2
Line3
....."

keeptwentyline($mytext);
?>

© Stack Overflow or respective owner

Related posts about php