More String Functions
strlen, strtoupper, ucfirst, trim, str_replace, substr, strpos and str_contains cover most text work.
Example
$s = " hello world ";
echo strlen(trim($s)), " ", ucwords(trim($s)), "\n";
echo substr("abcdef", 1, 3), " ", strpos("abc", "c"), " ", str_replace("a", "A", "banana");Result
11 Hello World bcd 2 bAnAnA
Exercise
Part of a string.
("abc", 1, 2)Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.