Tag Archives: PHP string

PHP String functions

PHP String Functions PHP strings are sequences of characters, like ” Hello World “. In this chapter we will see the commonly used string functions.

str_len() Function

This function is used get the total number of characters in string .

<?php
echo str_len("Test String");
?>

Output:
11

addslashes() Function

This function will return the string with backslashes in-front of the special character.

<?php
$str_data = addslashes("It's test data");
?>

Output:
It\'s test data

Below mentioned the lists of PHP string function for your reference. The examples for these will be update soon.

  1. addcslashes
  2. addslashes
  3. bin2hex
  4. chop
  5. chr
  6. chunk_split
  7. convert_cyr_string
  8. convert_uudecode
  9. convert_uuencode
  10. count_chars
  11. crc32
  12. crypt
  13. echo
  14. explode
  15. fprintf
  16. get_html_translation_table
  17. hebrev
  18. hebrevc
  19. hex2bin
  20. html_entity_decode
  21. htmlentities
  22. htmlspecialchars_decode
  23. htmlspecialchars
  24. implode
  25. join
  26. lcfirst
  27. levenshtein
  28. localeconv
  29. ltrim
  30. md5_file
  31. md5
  32. metaphone
  33. money_format
  34. nl_langinfo
  35. nl2br
  36. number_format
  37. ord
  38. parse_str
  39. print
  40. printf
  41. quoted_printable_decode
  42. quoted_printable_encode
  43. quotemeta
  44. rtrim
  45. setlocale
  46. sha1_file
  47. sha1
  48. similar_text
  49. soundex
  50. sprintf
  51. sscanf
  52. str_getcsv
  53. str_ireplace
  54. str_pad
  55. str_repeat
  56. str_replace
  57. str_rot13
  58. str_shuffle
  59. str_split
  60. str_word_count
  61. strcasecmp
  62. strchr
  63. strcmp
  64. strcoll
  65. strcspn
  66. strip_tags
  67. stripcslashes
  68. stripos
  69. stripslashes
  70. stristr
  71. strlen
  72. strnatcasecmp
  73. strnatcmp
  74. strncasecmp
  75. strncmp
  76. strpbrk
  77. strpos
  78. strrchr
  79. strrev
  80. strripos
  81. strrpos
  82. strspn
  83. strstr
  84. strtok
  85. strtolower
  86. strtoupper
  87. strtr
  88. substr_compare
  89. substr_count
  90. substr_replace
  91. substr
  92. trim
  93. ucfirst
  94. ucwords
  95. vfprintf
  96. vprintf
  97. vsprintf
  98. wordwrap