- strlen(string)
- Return length of a string
- strpos(string, char)
- Return position of the first occurrence of a string in another string
- str_replace(old_word, new_word, string)
- Replace a string with another string in a string
- addslashes(str)
- Return a string by adding a backslash in front of commas in given string
- chr(number)
- Return the character of the specified character of ASCII (65)
- explode(string)
- Break a string into an array
- implode(array)
- Return a string from elements of an array.
- join
- Alternative of implode
- lcfirst(string)
- Convert the first character of a string into lower case
- md5(string)
- Calculate md5 of a string
- nl2br(string)
- Insert line break in front of each newline in a string
- ltrim (string)
- Remove whitespace and other characters from the left side of a string
- rtrim(string)
- Remove whitespace and other characters from the right side of a string
- str_split(string)
- Split a string into an array
- strip_tags(string)
- Strip HTML, PHP tags from a string
- substr(string, start, end)
- Return a part of a string
- ucfirst(string)
- Convert the first character into uppercase of a string
- ucwords(string)
- Convert the first character into uppercase of each word
- wordwrap(string, n, "\n\r<br>")
- Wrap a string to a given number of characters.
Example
<?php
echo strlen("web design");
echo "<br>";
echo str_word_count("web design");
echo "<br>";
echo strrev("web design");
echo "<br>";
echo strpos("web design", "design");
echo "<br>";
echo str_replace("design", "development", "web design");
echo "<br>";
echo addslashes("web design's");
echo "<br>";
echo chr(65);
echo "<br>";
print_r( explode(" ", "Web design") );
echo "<br>";
echo implode(" ", ["web", "design"]);
echo "<br>";
echo join(" ",["web", "design"]);
echo "<br>";
echo lcfirst("WEB DESIGN");
echo "<br>";
echo md5("web design");
echo "<br>";
echo nl2br("web design \r\n capscom technology almora");
echo "<br>";
echo ltrim(" web design ");
echo "<br>";
echo rtrim(" web design ");
echo "<br>";
print_r(str_split("web design"));
echo "<br>";
echo strip_tags("<h1>web design</h1>");
echo "<br>";
echo substr("web design", 3, 7);
echo "<br>";
echo ucfirst("web design");
echo "<br>";
echo ucwords("web design");
echo "<br>";
echo wordwrap("web design and development", 10, "<br>\n");
echo "<br>";
?>