PHP String Functions
The PHP string functions are part of the PHP core. No installation is required to use these functions.
SrN. | Function | Desc |
1 | addcslashes | Quote string with slashes in a C style |
2 | addslashes | Quote string with slashes |
3 | bin2hex | Convert binary data into hexadecimal representation |
4 | chop | Alias of rtrim |
5 | chr | Generate a single-byte string from a number |
6 | chunk_split | Split a string into smaller chunks |
7 | convert_cyr_string | Convert from one Cyrillic character set to another |
8 | convert_uudecode | Decode a uuencoded string |
9 | convert_uuencode | Uuencode a string |
10 | count_chars | Return information about characters used in a string |
11 | crc32 | Calculates the crc32 polynomial of a string |
12 | crypt | One-way string hashing |
13 | echo | Output one or more strings |
14 | explode | Split a string by a string |
15 | fprintf | Write a formatted string to a stream |
16 | get_html_translation_table | Returns the translation table used by htmlspecialchars and htmlentities |
17 | hebrev | Convert logical Hebrew text to visual text |
18 | hebrevc | Convert logical Hebrew text to visual text with newline conversion |
19 | hex2bin | Decodes a hexadecimally encoded binary string |
20 | html_entity_decode | Convert HTML entities to their corresponding characters |
21 | htmlentities | Convert all applicable characters to HTML entities |
22 | htmlspecialchars_decode | Convert special HTML entities back to characters |
23 | htmlspecialchars | Convert special characters to HTML entities |
24 | implode | Join array elements with a string |
25 | join | Alias of implode |
26 | lcfirst | Make a string's first character lowercase |
27 | levenshtein | Calculate Levenshtein distance between two strings |
28 | localeconv | Get numeric formatting information |
29 | ltrim | Strip whitespace (or other characters) from the beginning of a string |
30 | md5_file | Calculates the md5 hash of a given file |
31 | md5 | Calculate the md5 hash of a string |
32 | metaphone | Calculate the metaphone key of a string |
33 | money_format | Formats a number as a currency string |
34 | nl_langinfo | Query language and locale information |
35 | nl2br | Inserts HTML line breaks before all newlines in a string |
36 | number_format | Format a number with grouped thousands |
37 | ord | Convert the first byte of a string to a value between 0 and 255 |
38 | parse_str | Parses the string into variables |
39 | Output a string | |
40 | printf | Output a formatted string |
41 | quoted_printable_decode | Convert a quoted-printable string to an 8 bit string |
42 | quoted_printable_encode | Convert a 8 bit string to a quoted-printable string |
43 | quotemeta | Quote meta characters |
44 | rtrim | Strip whitespace (or other characters) from the end of a string |
45 | setlocale | Set locale information |
46 | sha1_file | Calculate the sha1 hash of a file |
47 | sha1 | Calculate the sha1 hash of a string |
48 | similar_text | Calculate the similarity between two strings |
49 | soundex | Calculate the soundex key of a string |
50 | sprintf | Return a formatted string |
51 | sscanf | Parses input from a string according to a format |
52 | str_contains | Determine if a string contains a given substring |
53 | str_ends_with | Checks if a string ends with a given substring |
54 | str_getcsv | Parse a CSV string into an array |
55 | str_ireplace | Case-insensitive version of str_replace |
56 | str_pad | Pad a string to a certain length with another string |
57 | str_repeat | Repeat a string |
58 | str_replace | Replace all occurrences of the search string with the replacement string |
59 | str_rot13 | Perform the rot13 transform on a string |
60 | str_shuffle | Randomly shuffles a string |
61 | str_split | Convert a string to an array |
62 | str_starts_with | Checks if a string starts with a given substring |
63 | str_word_count | Return information about words used in a string |
64 | strcasecmp | Binary safe case-insensitive string comparison |
65 | strchr | Alias of strstr |
66 | strcmp | Binary safe string comparison |
67 | strcoll | Locale based string comparison |
68 | strcspn | Find length of initial segment not matching mask |
69 | strip_tags | Strip HTML and PHP tags from a string |
70 | stripcslashes | Un-quote string quoted with addcslashes |
71 | stripos | Find the position of the first occurrence of a case-insensitive substring in a string |
72 | stripslashes | Un-quotes a quoted string |
73 | stristr | Case-insensitive strstr |
74 | strlen | Get string length |
75 | strnatcasecmp | Case insensitive string comparisons using a "natural order" algorithm |
76 | strnatcmp | String comparisons using a "natural order" algorithm |
77 | strncasecmp | Binary safe case-insensitive string comparison of the first n characters |
78 | strncmp | Binary safe string comparison of the first n characters |
79 | strpbrk | Search a string for any of a set of characters |
80 | strpos | Find the position of the first occurrence of a substring in a string |
81 | strrchr | Find the last occurrence of a character in a string |
82 | strrev | Reverse a string |
83 | strripos | Find the position of the last occurrence of a case-insensitive substring in a string |
84 | strrpos | Find the position of the last occurrence of a substring in a string |
85 | strspn | Finds the length of the initial segment of a string consisting entirely of characters contained within a given mask |
86 | strstr | Find the first occurrence of a string |
87 | strtok | Tokenize string |
88 | strtolower | Make a string lowercase |
89 | strtoupper | Make a string uppercase |
90 | strtr | Translate characters or replace substrings |
91 | substr_compare | Binary safe comparison of two strings from an offset, up to length characters |
92 | substr_count | Count the number of substring occurrences |
93 | substr_replace | Replace text within a portion of a string |
94 | substr | Return part of a string |
95 | trim | Strip whitespace (or other characters) from the beginning and end of a string |
96 | ucfirst | Make a string's first character uppercase |
97 | ucwords | Uppercase the first character of each word in a string |
98 | utf8_decode | Converts a string from UTF-8 to ISO-8859-1, replacing invalid or unrepresentable characters |
99 | utf8_encode | Converts a string from ISO-8859-1 to UTF-8 |
100 | vfprintf | Write a formatted string to a stream |
101 | vprintf | Output a formatted string |
102 | vsprintf | Return a formatted string |
103 | wordwrap | Wraps a string to a given number of characters |
Related post
EknowledgePoint
Increase Your Knowledge with usEknowledgePoint is an innovative online learning platform that aims to democratize education by providing a vast array of courses and educational content to learners of all ages and backgrounds. It offers a diverse range of subjects, from academic topics to practical skills, making it a one-stop destination for anyone looking to expand their knowledge base.
5 comments
Knowledge is the fuel that powers our journey through life. It's platforms like EknowledgePoint that transform information into enlightenment, curiosity into competence, and dreams into reality. Embrace the opportunity to learn, and you'll find that the doors of possibility swing wide open. 🚀💡 #EknowledgePoint.
Thank you for your kind words! At EknowledgePoint, we are dedicated to empowering individuals on their learning journey. Your enthusiasm for knowledge and personal growth inspires us to keep providing the best educational resources and experiences. Let's continue to explore and learn together!.
Thanks For Your Support.
"I'm constantly amazed by the quality of instructors on EknowledgePoint. Learning from experts in their fields is both enlightening and empowering. 🌟👨🏫 #EknowledgePoint.
EknowledgePoint isn't just a platform; it's a community of learners. The support and camaraderie here are truly inspiring. 🤝🌍 #EknowledgePoint.