String Functions

<?php
$text = " Hello PHP! ";

echo strlen($text);    // 11
echo strtolower($text); // hello php!
echo strtoupper($text); // HELLO PHP!
echo trim($text);       // removes extra spaces
echo str_replace("PHP", "World", $text); // Hello World!
?>

Explanation:
PHP has many string functions for modifying and formatting text.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *