PHP count number of lines in a string

$total_lines = count(explode('
', $content));

or

$total_lines = count(explode('\n', $content));

Leave a Reply

Your email address will not be published.