PHP String Introduction
  • PHP String Introduction:- The string functions allow you to play around with strings.

PHP String Functions

Function Description PHP
addcslashes() adds backslashes in front of the specified characters and returns the string 4
addslashes() adds backslashes in front of predefined characters and returns string 3
bin2hex() a string of ASCII characters is converted to hexadecimal values 3
chop() alias to rtrim() 3
chr() converts a specified ASCII value to character and returns it 3
chunk_split() specified string is divided into a series of smaller parts 3
convert_cyr_string() one Cyrillic character-set from specified string is converted to another 3
convert_uudecode() a uuencoded string is decoded 5
convert_uuencode() using the uuencode algorithm, a specified string is encoded 5
count_chars() returns the count of an ASCII character occurrence within a specified string and returns the information 4
crc32() a 32-bit CRC is calculated for a specified string 4
crypt() string is encrypted in one-way (hashing) 3
echo() prints string 3
explode() returns an array formed from a specified string 3
fprintf() allows to write a formatted string to a specified output stream 5
get_html_translation_table() returns the translation table used by htmlspecialchars() and htmlentities() 4
hebrev() Hebrew text is converted to visual text 3
hebrevc() Hebrew text is converted to visual text and also new lines (\n) are converted to <br /> 3
html_entity_decode() HTML entities are converted to characters 4
htmlentities() characters are converted to HTML entities 3
htmlspecialchars_decode() some predefined HTML entities are converted to characters 5
htmlspecialchars() some predefined characters are converted to HTML entities 3
implode() returns a string formed from the elements of an array 3
join() alias to implode() 3
levenshtein() calculates the Levenshtein distance between two strings and returns 3
ltrim() whitespace from the left side of a specified string is striped 3
md5() returns the calculated MD5 hash of a specified string 3
md5_file() returns the calculated MD5 hash of a specified file 4
metaphone() returns a calculated metaphone key of a specified string 4
nl2br() adds HTML line breaks (\n) in front of each newline in a specified string 3
number_format() returns a formatted number with grouped thousands 3
ord() calculates the ASCII value of the first character of a specified string and returns 3
parse_str() a query string is parsed into variables and returned 3
print() prints a string 3
printf() prints a formatted string 3
quoted_printable_decode() returns a decoded string from quoted-printable string 3
quotemeta() quotes meta characters from specified string and returns 3
rtrim() whitespace from the right side of a specified string is striped 3
setlocale() locale information is set 3
sha1() returns a calculated SHA-1 hash of a specified string 4
sha1_file() returns a calculated SHA-1 hash of a specified file 4
similar_text() returns the calculated similarity between two specified strings 3
soundex() returns a calculated soundex key of a specified string 3
sprintf() writes a formatted string to a variable 3
sscanf() Parses input from a string according to a format 4
str_ireplace() returns a string by replacing some characters in a specified string (case-insensitive) 5
str_pad() returns a string by padding a specified string to a new length 4
str_repeat() returns a string by repeating a specified string for a specified number of times 4
str_replace() returns a string by replacing some characters in a specified string (case-sensitive) 3
str_rot13() returns a calculated ROT13 encoded of a specified string 4
str_shuffle() returns a string by Randomly shuffling all characters in a specified string 4
str_split() returns an array by splitting a specified string into an array 5
str_word_count() calculates the number of words in a specified string and returns 4
strcasecmp() returns the comparison of two specified strings (case-insensitive) 3
strchr() finds the first occurrence of a string inside another string (alias of strstr()) and returns the rest of the string 3
strcmp() returns the comparison of two specified strings (case-sensitive) 3
strcoll() returns the result of locale based string comparison 4
strcspn() Returns the number of characters found in a string before any part of some specified characters are found 3
strip_tags() returns a string by removing HTML and PHP tags from a specified string 3
stripcslashes() returns a string by removing backslashes added by the addcslashes() function 4
stripslashes() returns a string by removing backslashes added by the addslashes() function 3
stripos() calculates the position of first occurrence of a string inside another string and returns it (case-insensitive) 3
stristr() calculates the first occurrence of a string inside another string (case-insensitive) 3
strlen() calculates the length of a string and returns 3
strnatcasecmp() returns the comparison of two strings using a “natural order” algorithm (case-insensitive) 4
strnatcmp() returns the comparison of two strings using a “natural order” algorithm (case-sensitive) 4
strncasecmp() returns the result of string comparison of the first n characters (case-insensitive) 4
strncmp() returns the result of string comparison of the first n characters (case-sensitive) 4
strpbrk() searches a string for any of a set of characters and returns the rest of string 5
strpos() calculates the position of first occurrence of a string inside another string and returns it(case-sensitive) 3
strrchr() calculates the last occurrence of a string inside another string 3
strrev() returns a string after reversing 3
strripos() calculates the position of the last occurrence of a string inside another string and returns it(case-insensitive) 5
strrpos() calculates the position of the last occurrence of a string inside another string and returns it(case-sensitive) 3
strspn() returns the number of characters found in a string that contains only characters from a specified charlist 3
strstr() calculates the first occurrence of a string inside another string and returns it(case-sensitive) 3
strtok() divides a string into smaller strings and returns it 3
strtolower() returns a string after converting to lowercase letters 3
strtoupper() returns a string after converting to uppercase letters 3
strtr() returns a string after translating certain characters in a specified string 3
substr() returns a specified part of a string 3
substr_compare() returns a result of comparison of two strings from a specified start position (binary safe and optionally case-sensitive) 5
substr_count() returns the count of number of times a substring occurs in a string 4
substr_replace() returns a modified string after replacing a part of a specified string with another specified string 4
trim() returns a string after removing whitespace from both sides of a specified string 3
ucfirst() returns a string after changing a first character of a specified string to uppercase 3
ucwords() returns a string after changing the first character of each word in a specified string to uppercase 3
vfprintf() writes a formatted string to a specified stream 5
vprintf() prints a formatted string 4
vsprintf() returns a formatted string 4
wordwrap() wraps a string to a given number of characters 4
SHARE
Previous articlePHP Array Functions
Next articlePHP Zip File
I am a young Information Systems Security Engineer(CEH). I had started with penetration testing when i am 17 years old. It all started with Kali linux and Metasploit.In free time i will play with Security holes/Bug bounty/Pentesting and Hacking !!!