This total PHP string functions Reference contains all the Php string functions explained (detailed) with an example each.

PHP STRING FUNCTIONS

  • addcslashes() : Quotes / Outputs string with slashes in a C style
  • addslashes() : Quotes / Outputs string with slashes
  • bin2hex() : Converts binary data into hexadecimal representation
  • chop() : Alias of rtrim
  • chr() : Generates the single-byte string from a number(integer)
  • chunk_split() : Split a string into smaller chunks
  • Converts_cyr_string() : Changes set of Cyrillic character from one to another
  • Converts_uudecode() : Decode a uuencoded string
  • Converts_uuencode() : Uuencode a string
  • count_chars() : Returns details about characters that were used in a string
  • crc32() : Calculates a string crc32 polynomial
  • crypt() : Returns One-way string hashing
  • echo() : Outputs one or more strings
  • explode() : Splits a string by a string
  • fprintf() : Writes a formatted string to a stream
  • get_html_translation_table() : Returns the used htmlspecialchars and htmlentities in a translation table
  • hebrev() : Converts logical Hebrew text to visual text
  • hebrevc() : Converts logical Hebrew text to visual text with newline conversion
  • hex2bin() : Decodes a hexadecimally encoded binary string
  • html_entity_decode() : Converts HTML entities to their corresponding characters
  • htmlentities() : Converts all applicable characters to HTML entities
  • htmlspecialchars_decode() : Converts special HTML entities back to characters
  • htmlspecialchars() : Converts special characters to HTML entities
  • implode() : Joins array elements with a string
  • join() : An Alias of implode
  • lcfirst() : Make a string’s first character lowercase
  • levenshtein() : Calculates Levenshtein distance between two strings
  • localeconv() : Gets numeric formatting information
  • ltrim() : Strips whitespace (or other characters) from the beginning of a string
  • md5_file() : Calculates the md5 hash of a defined selected file
  • md5() : Calculates a defined string md5 hash
  • metaphone() : Calculates a string the metaphone keys
  • money_format() : Formats a number to currency string
  • nl_langinfo() : Query language and locale information
  • nl2br() : Inserts in a string a HTML line breaks before every new-lines
  • number_format() : Formats a number with grouped thousands
  • ord() : Converts the first byte of a string to a value between 0 and 255
  • parse_str() : Parses the string into variables
  • print() : Outputs a string
  • printf() : Outputs a formatted string
  • quoted_printable_decode() : Converts a Quotes / quoted-printable string to an 8-bit string
  • quoted_printable_encode() : Converts an 8-bit string to a Quotes / quoted-printable string
  • quotemeta() : Quotes / Outputs meta characters
  • rtrim() : Strips from the end of string whitespace (or other characters)
  • setlocale() : Set locale information
  • sha1_file() : Calculates a defined file sha1 hash
  • sha1() : Calculates a defined string sha1 hash
  • similar_text() : Calculates the similarity between two strings
  • soundex() : Calculates a string soundex key of
  • sprintf() : Returns a formatted string
  • sscanf() : according to a format Parses input from a string
  • str_getcsv() : Parses into an array a CSV string
  • str_ireplace() : Case-insensitive version of str_replace
  • str_pad() : Pads a string to a definite length using another string
  • str_repeat() : Repeats a string
  • str_replace() : Replaces every occurrences of a searched string using the replacement string
  • str_rot13() : Transforms a string to its value in the rot13
  • str_shuffle() : Randomly shuffles a string
  • str_split() : Converts a string to an array
  • str_word_count() : Returns details/information about words contained in a string
  • strcasecmp() : Binary safe case-insensitive string comparison
  • strchr() : An Alias of strstr
  • strcmp() : Binary safe string comparison
  • strcoll() : Locale based string comparison
  • strcspn() : Finds the length of the initial segment but not the matching mask
  • strip_tags() : Strips Contained HTML and PHP tags in a string from that string
  • stripcslashes() : Un-Quotes / Outputs string Quotes / quoted with addcslashes
  • stripos() : Finds the position of the first occurrence of a case-insensitive substring in a string
  • stripslashes() : Un-Quotes / Outputs a Quotes / quoted string
  • stristr() : Case-insensitive strstr
  • strlen() : Get string length
  • strnatcasecmp() : uses “natural order” algorithm for a Case insensitive string comparison
  • strnatcmp() : uses the algorithm of “natural order” to compare a string and its case sensitive
  • strncasecmp() : A case insensitive string comparisons used for the first n characters and it is binary safe
  • strncmp() : A string comparisons used for the first n characters  and it is binary safe
  • strpbrk() : Searches a string for a set of characters (any set of characters defined)
  • strpos() : Finds in a string the first occurrence position of a particular substring
  • strrchr() : Finds in a string the last occurrence of a particular character
  • strrev() : Reverses a string
  • strripos() : Finds the position of the last occurrence of a case-insensitive substring in a string
  • strrpos() : Finds the position of the last occurrence of a substring in a string
  • strspn() : Finds within a defined mask the length of the string initial segment that consists entirely all of the characters contained
  • strstr() : Finds a string defined the first occurrence
  • strtok() : Tokenize string
  • strtolower() : Makes a string lowercase
  • strtoupper() : Makes a string uppercase
  • strtr() : Translates characters or replace substrings
  • substr_compare() : compares two strings from a defined offset, up to length characters in Binary safe
  • substr_count() : Count the number of substring occurrences
  • substr_replace() : Replaces text that is within a portion of a string
  • substr() : Return part of a string
  • trim() : Strips from the beginning and end of string whitespaces (or other characters)
  • ucfirst() : Make a string’s first character uppercase
  • ucwords() : Changes the first character of each word in a string to Uppercase (title case)
  • vfprintf() : Writes  to a stream the formatted string
  • vprintf() : Output a formatted string
  • vsprintf() : Returns a formatted string
  • wordwrap() : Wraps a string to a defined number of characters

LEAVE A REPLY

Please enter your comment!
Please enter your name here