php strlen function works fine when : php strlen function works fine when its  echo from **given variable** but when I give input **usgin stdin** then strlen function can not work perfectly. Pls help me.

    
<?php

function CheckUsername($username){


$static ="This is a pen";
echo strlen($static);

**Output:13**

**usng stdin (same input:This is a pen)**

echo (strlen($username));

**output:4**

}

    $stdin = fopen('php://stdin','r');
    $stdout = fopen('php://stdout','w');
    $testCase = 0; 
    $username = 0;

    fscanf(STDIN,"%d\n",$testCase); 
      for($i=0;$i<$testCase;$i++)
      {
       fscanf(STDIN,"%s\n",$username); 
       $result = CheckUsername($username); 

       fprintf(STDOUT,"%s\n",$result); 
       }
?>

**SO why it can not return 13 as a output**

