Posted by: Sourav | February 8, 2011

Some string functions

$firststring=”The quick brown fox”;
$secondstring=” jumped over the lazy dog.”;
echo $thirdstring;
<br />
Lowercase:<?php echo strtolower($thirdstring); ?><br />
Uppercase:<?php echo strtoupper($thirdstring); ?><br />
Uppercase First Letter:<?php echo ucfirst($thirdstring); ?><br />
Uppercase Words:<?php echo ucwords($thirdstring); ?><br />
<br />
Length:<?php echo strlen($thirdstring); ?><br />
Trim:<?php echo $fourthstring=$firststring.trim($secondstring); ?><br />
Find:<?php echo strstr($thirdstring,”brown”); ?><br />
Replace by string<?php echo str_replace(“quick”,”super fast”,$thirdstring); ?><br />
<br />


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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


%d bloggers like this: