Working with Strings in PHP
Use built-in PHP string functions to manipulate and format text.
Thomas King
September 24, 2025
2.6k54
Strings are used everywhere. PHP gives many helpers.
Common string functions
$text = " Hello World ";
echo strlen($text);
echo trim($text);
echo strtoupper($text);
echo strtolower($text);
echo str_replace("World", "PHP", $text);
Splitting and joining
$words = explode(" ", "I love PHP");
echo implode("-", $words);
Next: Date and time in PHP.
#PHP#Strings#Beginner