PHP trim

Posted: January 3, 2010 in PHP, TRIM
Tags: ,

<?php
$text = ” Hello “;
$textlen = strlen($text);
echo “Text is : $text \n”;
echo “Text length before trim : $textlen \n”;
$text = trim($text);
$textlen = strlen($text);
echo “Text length after trim  : $textlen \n”;
?>

Result: -

Text is :  Hello

Text length before trim : 7

Text length after trim  : 5

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s