$string = "Hello world"; $length = strlen($string); // $length = 11
$string = "Hello World"; $lowercase = strtolower($string); // $lowercase = "hello world"
$string = "Hello World"; $new_string = str_replace("World", "Universe", $string); // $new_string = "Hello Universe"
$string = "Hello World"; $substring = substr($string, 0, 5); // $substring = "Hello"
$string = " Hello World "; $trimmed = trim($string); // $trimmed = "Hello World"Package library: No external package/library required. Overall, PHP String is a very useful library for working with strings in PHP. It is built-in, so no external packages or libraries are required.