PHP trim


<?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

Tagged: ,

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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: