How can you differentiate between line breaks and page breaks when processing text in PHP?

When processing text in PHP, line breaks are represented by the "\n" character, while page breaks are typically represented by "\f" or "\r\n" depending on the source of the text. To differentiate between the two, you can use the strpos function to check for the presence of these characters in the text.

$text = "This is a text with\nline breaks and\fpage breaks.";

if(strpos($text, "\n") !== false){
    echo "This text contains line breaks.";
}

if(strpos($text, "\f") !== false || strpos($text, "\r\n") !== false){
    echo "This text contains page breaks.";
}