01String functions
main.php
<?php
$s = "Hello, PHP";
echo strlen($s), "\n";
echo strtoupper($s), "\n";
echo strtolower($s), "\n";Output
10 HELLO, PHP hello, php
Master PHP string functions: measure length, change case, concatenate, replace, find, split, and join text.
<?php
$s = "Hello, PHP";
echo strlen($s), "\n";
echo strtoupper($s), "\n";
echo strtolower($s), "\n";10 HELLO, PHP hello, php
<?php
$first = "Py";
$second = "thon";
echo $first . $second . "\n";Python
<?php
$text = "I like cats";
echo str_replace("cats", "dogs", $text), "\n";
echo strpos($text, "like"), "\n";I like dogs 2
<?php
$csv = "red,green,blue";
$parts = explode(",", $csv);
echo $parts[1], "\n";
echo implode(" | ", $parts), "\n";green red | green | blue