डिप्लोमा इन ऑफिस मैनेजमेंट एण्ड अकाउटिंग

डिप्लोमा इन ऑफिस मैनेजमेंट एण्ड अकाउटिंग

Full Stack Web Development with Laravel

Full Stack Web Development with Laravel

Affiliate Program

Affiliate Program

PHP string functions

  1. strlen(string)
    Return length of a string
  2. strpos(string, char)
    Return position of the first occurrence of a string in another string
  3. str_replace(old_word, new_word, string)
    Replace a string with another string in a string
  4. addslashes(str)
    Return a string by adding a backslash in front of commas in given string
  5. chr(number)
    Return the character of the specified character of ASCII (65)
  6. explode(string)
    Break a string into an array
  7. implode(array)
    Return a string from elements of an array.
  8. join
    Alternative of implode
  9. lcfirst(string)
    Convert the first character of a string into lower case
  10. md5(string)
    Calculate md5 of a string
  11. nl2br(string)
    Insert line break in front of each newline in a string
  12. ltrim (string)
    Remove whitespace and other characters from the left side of a string
  13. rtrim(string)
    Remove whitespace and other characters from the right side of a string
  14. str_split(string)
    Split a string into an array
  15. strip_tags(string)
    Strip HTML, PHP tags from a string
  16. substr(string, start, end)
    Return a part of a string
  17. ucfirst(string)
    Convert the first character into uppercase of a string
  18. ucwords(string)
    Convert the first character into uppercase of each word
  19. 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>";
?>
© 2016 - 2023, All Rights are Reserved.