A Comprehensive Reference of String Functions in PHP

All these functions are used to manipulate strings in one way or another. They are part of the PHP core and you don't have to install anything to use these functions.

  1. addcslashes — This function is used to quote a given string with slashes in a C style format.
  2. addslashes — This function is used to quote string with slashes.
  3. bin2hex — This function is used to convert binary data into hexadecimal representation.
  4. chop — This function is an alias of rtrim.
  5. chr — This function is used to return a specific character.
  6. chunk_split — This function is used to split a string into smaller chunks.
  7. convert_cyr_string — This function is used to convert from one Cyrillic character set to another.
  8. convert_uudecode — This function is used to decode a uuencoded string.
  9. convert_uuencode — This function is used to uuencode a string.
  10. count_chars — This function is used to return information about characters used in a string.
  11. crc32 — This function is used to calculates the crc32 polynomial of a string.
  12. crypt — This function is used to one-way string hashing.
  13. echo — This function is used to output one or more strings.
  14. explode — This function is used to split a string by string.
  15. fprintf — This function is used to write a formatted string to a stream.
  16. get_html_translation_table — This function is used to returns the translation table used by htmlspecialchars and htmlentities.
  17. hebrev — This function is used to convert logical Hebrew text to visual text.
  18. hebrevc — This function is used to convert logical Hebrew text to visual text with newline conversion.
  19. hex2bin — This function is used to decodes a hexadecimally encoded binary string.
  20. html_entity_decode — This function is used to convert all HTML entities to their applicable characters.
  21. htmlentities — This function is used to convert all applicable characters to HTML entities.
  22. htmlspecialchars_decode — This function is used to convert special HTML entities back to characters.
  23. htmlspecialchars — This function is used to convert special characters to HTML entities.
  24. implode — This function is used to join array elements with a string.
  25. join — This function is an alias of implode.
  26. lcfirst — This function is used to make a string's first character lowercase.
  27. levenshtein — This function is used to calculate Levenshtein distance between two strings.
  28. localeconv — This function is used to get numeric formatting information.
  29. ltrim — This function is used to strip whitespace (or other characters) from the beginning of a string.
  30. md5_file — This function is used to calculates the md5 hash of a given file.
  31. md5 — This function is used to calculate the md5 hash of a string.
  32. metaphone — This function is used to calculate the metaphone key of a string.
  33. money_format — This function is used to formats a number as a currency string.
  34. nl_langinfo — This function is used to query language and locale information.
  35. nl2br — This function is used to inserts HTML line breaks before all newlines in a string.
  36. number_format — This function is used to format a number with grouped thousands.
  37. ord — This function is used to return ASCII value of character.
  38. parse_str — This function is used to parses the string into variables.
  39. print — This function is used to output a string.
  40. printf — This function is used to output a formatted string.
  41. quoted_printable_decode — This function is used to convert a quoted-printable string to an 8 bit string.
  42. quoted_printable_encode — This function is used to convert a 8 bit string to a quoted-printable string.
  43. quotemeta — This function is used to quote meta characters.
  44. rtrim — This function is used to strip whitespace (or other characters) from the end of a string.
  45. setlocale — This function is used to set locale information.
  46. sha1_file — This function is used to calculate the sha1 hash of a file.
  47. sha1 — This function is used to calculate the sha1 hash of a string.
  48. similar_text — This function is used to calculate the similarity between two strings.
  49. soundex — This function is used to calculate the soundex key of a string.
  50. sprintf — This function is used to return a formatted string.
  51. sscanf — This function is used to parses input from a string according to a format.
  52. str_getcsv — This function is used to parse a CSV string into an array.
  53. str_ireplace — This function is used to case-insensitive version of str_replace..
  54. str_pad — This function is used to pad a string to a certain length with another string.
  55. str_repeat — This function is used to repeat a string.
  56. str_replace — This function is used to replace all occurrences of the search string with the replacement string.
  57. str_rot13 — This function is used to perform the rot13 transform on a string.
  58. str_shuffle — This function is used to randomly shuffles a string.
  59. str_split — This function is used to convert a string to an array.
  60. str_word_count — This function is used to return information about words used in a string.
  61. strcasecmp — This function is used to binary safe case-insensitive string comparison.
  62. strchr — This function is an alias of strstr.
  63. strcmp — This function is used to binary safe string comparison.
  64. strcoll — This function is used to locale based string comparison.
  65. strcspn — This function is used to find length of initial segment not matching mask.
  66. strip_tags — This function is used to strip HTML and PHP tags from a string.
  67. stripcslashes — This function is used to un-quote string quoted with addcslashes.
  68. stripos — This function is used to find the position of the first occurrence of a case-insensitive substring in a string.
  69. stripslashes — This function is used to un-quotes a quoted string.
  70. stristr — This function is used to case-insensitive strstr.
  71. strlen — This function is used to get string length.
  72. strnatcasecmp — This function is used to case insensitive string comparisons using a "natural order" algorithm.
  73. strnatcmp — This function is used to string comparisons using a "natural order" algorithm.
  74. strncasecmp — This function is used to binary safe case-insensitive string comparison of the first n characters.
  75. strncmp — This function is used to binary safe string comparison of the first n characters.
  76. strpbrk — This function is used to search a string for any of a set of characters.
  77. strpos — This function is used to find the position of the first occurrence of a substring in a string.
  78. strrchr — This function is used to find the last occurrence of a character in a string.
  79. strrev — This function is used to reverse a string.
  80. strripos — This function is used to find the position of the last occurrence of a case-insensitive substring in a string.
  81. strrpos — This function is used to find the position of the last occurrence of a substring in a string.
  82. strspn — This function is used to finds the length of the initial segment of a string consisting entirely of characters contained within a given mask..
  83. strstr — This function is used to find the first occurrence of a string.
  84. strtok — This function is used to tokenize string.
  85. strtolower — This function is used to make a string lowercase.
  86. strtoupper — This function is used to make a string uppercase.
  87. strtr — This function is used to translate characters or replace substrings.
  88. substr_compare — This function is used to binary safe comparison of two strings from an offset, up to length characters.
  89. substr_count — This function is used to count the number of substring occurrences.
  90. substr_replace — This function is used to replace text within a portion of a string.
  91. substr — This function is used to return part of a string.
  92. trim — This function is used to strip whitespace (or other characters) from the beginning and end of a string.
  93. ucfirst — This function is used to make a string's first character uppercase.
  94. ucwords — This function is used to uppercase the first character of each word in a string.
  95. vfprintf — This function is used to write a formatted string to a stream.
  96. vprintf — This function is used to output a formatted string.
  97. vsprintf — This function is used to return a formatted string.
  98. wordwrap — This function is used to wraps a string to a given number of characters.

Follow Us For Updates

FacebookTwitterGoogle+
Go To Top