String Functions
These are the basic string manipulation functions supported by PHP. They are all 8-bit clean, which means that the data they act on does not necessarily have to be straight text. In other words, a string may include any character in the ASCII table including 0. Here are the string functions:
string addslashes(string str)Escape single quotes, double quotes, and backslash characters in a string with backslashes
string base64_decode(string str)Decode a string with MIME base-64
string base64_encode(string str)Encode a string with MIME base-64
string chop(string str)Remove trailing whitespace
string chr(int ascii)Convert an ASCII code to a character
string chunk_split(string str [, int chunklen [,string ending]])Return split line
string convert_cyr_string(string str, stringfrom, string to)Convert from one Cyrillic character set to another
string crypt(string str [, string salt])DES-encrypt a string
string decrypt(string data, int type, stringkey)Decrypt string with
keyusing algorithmtype(converse ofencrypt( ))string encrypt(string data, int type, stringkey)Encrypts string with
keyusing algorithmtype(converse ofdecrypt( ))int ereg(string pattern, string string [, arrayregisters])POSIX-style regular expression match
string ereg_replace(string pattern, stringstring [, array registers])Replace pattern in a string using a POSIX-style regular expression
int eregi(string pattern, string string [, arrayregisters])Case-insensitive POSIX-style regular expression match ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access