PHP: How do I only echo half a string?

$password = "Hello there"
$halflen = float(strlen($password)/2);
$shortpw = substr($password, 0 , $halflen)."...";
echo $shortpw;
 
Back
Top