PHP strlen()函数在enterkey计数中的异常行为

I am trying to find the count of following text in php using strlen() function,

<?php
    $a=" VII,C :06/11 ENG:TRANSLATION HUMAN BODY STRUCTURE
    TAM:FINISH CW &PULAVAR BOOK
    MAT:LEARN LN-1
    SOC:GEO:-1 CHOOSE,FILL UPS&MATCH
    SCI:MATTER&ITS NATURE.
    ";
?>

It returns 155 character length.

you can run the sample here http://codepad.org/qIJ0fBEj

and I removed the five enter spaces and run the below code,

<?php
$a=" VII,C :06/11 ENG:TRANSLATION HUMAN BODY STRUCTURETAM:FINISH CW &PULAVAR BOOKMAT:LEARN LN-1SOC:GEO:-1 CHOOSE,FILL UPS&MATCHSCI:MATTER&ITS NATURE.";
echo strlen($a);
?>

check the sample here http://codepad.org/JDFy6Y1t

It returns 145. How the 5 enter keys takes 10 count??

I bet this input came from a Windows computer. The new line is actually a carriage return () and a new line character (). Thus two characters for each new line.

+1 for John, carriage return is the issue. You can use str_replace to remove all the carriage returns from the string.

$a = str_replace("
", "
", $a); // in windows